# Platform velocity different than 0 in ECEF coordinates

16 ビュー (過去 30 日間)
Carlos 2024 年 5 月 8 日

I am testing MATLAB satellite scenarios and coordinates frames. So I define a satellite scenario, and then I define a platform with a 0 velocity trajectory. Then I call the states function to get the position and velocity of the platform.
By default, the coordinate frame used by the states function is GCRF (inertial), therefore I would expect that my platform would have non-0 velocity and therefore a changing position due to the rotation of the Earth. On the other side, I would expect my platform to have 0 velocity and fixed position when I call states using ECEF coordinate frame, since it rotates along with the Earth, and any object on the surface of the Earth will be fixed in this coordinate system.
What I get when calling the states function is that positions behave as they should, that is, they are constant in the ECEF frame and variable in the GCRF (inertial) frame, but the velocities are weird. The velocities are non-0 (and are even variable) on ECEF coordinate system, and they are constant (non-0) on the GCRF (inertial) frame, which also doesn't make sense because as the Earth rotates, the orientation of the velocity vector of my platform should change direction.
The funny thing is that when I call the states function specifying a datetime timeIn, the velocities do behave as they are supposed to, that is, they are 0 in the ECEF frame, and variable non-0 in the GCRF frame. This suggests that either there is something wrong in the implementation of the states function for platforms, or I'm doing something wrong in the definition of the platform and/or the call to the states function, so here is my code:
%% Satellite scenario parameters
mission.StartDate = datetime(2023,10,9,7,10,0,TimeZone="America/New_York");
mission.Duration = minutes(10);
mission.stopTime = mission.StartDate + mission.Duration;
sampleTime = 60; %seconds
mission.scenario = satelliteScenario(mission.StartDate,mission.stopTime,sampleTime);
%% Aircraft Trajectory
waypoints = [... % Latitude (deg), Longitude (deg), Altitude (meters)
40.6289,-73.7738,3;...
40.6289,-73.7738,3;...
];
timeOfArrival = duration([... % time (HH:mm:ss)
"00:00:00";...
"00:10:00"]);
geo_traj = geoTrajectory(waypoints,seconds(timeOfArrival));
aircraft.obj = platform(mission.scenario,geo_traj);
%% States
[pos_ine,vel_ine]=states(aircraft.obj) % Inertial, pos should be variable and vel should be variable (norm(vel) should be constant)
[pos_ecef,vel_ecef]=states(aircraft.obj,"c","ecef") % ECEF, pos should be constant, vel should be 0
% When specifying a time for evaluation, velocity behaves as expected
time = datetime(2023,10,9,7,11,0,TimeZone="America/New_York"); % t = 1 min
[~,vel1_ine]=states(aircraft.obj,time)
[~,vel1_ecef]=states(aircraft.obj,time,"c","ecef")
% vel2_ine should be different than vel1_ine, but norm(vel1_ine) should be equal to norm(vel2_ine)
% vel1_ecef and vel2_ecef should be 0
time = datetime(2023,10,9,7,19,0,TimeZone="America/New_York"); % t = 9 min
[~,vel2_ine]=states(aircraft.obj,time)
[~,vel2_ecef]=states(aircraft.obj,time,"c","ecef")
norm(vel1_ine)-norm(vel2_ine)
##### 1 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
William Rose 2024 年 5 月 8 日

@Carlos, My "answer" below was intended to be a comment, not an answer.
I do not have the Sensor Fusion or Radar toolbox, so I cannot run geotrajectory(). So I need to find another way to specify the trajectory to pass to platform(), before I can run a version of your script locally.

サインインしてコメントする。

### 回答 (1 件)

William Rose 2024 年 5 月 8 日
%% Satellite scenario parameters
mission.StartDate = datetime(2023,10,9,7,10,0,TimeZone="America/New_York");
mission.Duration = minutes(10);
mission.stopTime = mission.StartDate + mission.Duration;
sampleTime = 60; %seconds
mission.scenario = satelliteScenario(mission.StartDate,mission.stopTime,sampleTime);
%% Aircraft Trajectory
waypoints = [... % Latitude (deg), Longitude (deg), Altitude (meters)
40.6289,-73.7738,3;...
40.6289,-73.7738,3;...
];
timeOfArrival = duration([... % time (HH:mm:ss)
"00:00:00";...
"00:10:00"]);
geo_traj = geoTrajectory(waypoints,seconds(timeOfArrival));
aircraft.obj = platform(mission.scenario,geo_traj);
%% States
[pos_ine,vel_ine]=states(aircraft.obj) % Inertial, pos should be variable and vel should be variable (norm(vel) should be constant)
pos_ine = 3x11
1.0e+06 * -1.7465 -1.7663 -1.7860 -1.8057 -1.8253 -1.8450 -1.8645 -1.8841 -1.9036 -1.9230 -1.9425 4.5184 4.5107 4.5029 4.4950 4.4870 4.4789 4.4708 4.4625 4.4542 4.4458 4.4373 4.1351 4.1351 4.1352 4.1352 4.1353 4.1353 4.1354 4.1354 4.1355 4.1355 4.1355
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
vel_ine = 3x11
339.4066 339.4066 339.4066 339.4066 339.4066 339.4066 339.4066 339.4066 339.4066 339.4066 339.4066 98.7751 98.7751 98.7751 98.7751 98.7751 98.7751 98.7751 98.7751 98.7751 98.7751 98.7751 0 0 0 0 0 0 0 0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
[pos_ecef,vel_ecef]=states(aircraft.obj,"c","ecef") % ECEF: expect pos=constant, vel=0
pos_ecef = 3x11
1.0e+06 * 1.3545 1.3545 1.3545 1.3545 1.3545 1.3545 1.3545 1.3545 1.3545 1.3545 1.3545 -4.6544 -4.6544 -4.6544 -4.6544 -4.6544 -4.6544 -4.6544 -4.6544 -4.6544 -4.6544 -4.6544 4.1312 4.1312 4.1312 4.1312 4.1312 4.1312 4.1312 4.1312 4.1312 4.1312 4.1312
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
vel_ecef = 3x11
-686.1444 -686.4418 -686.7326 -687.0168 -687.2943 -687.5651 -687.8293 -688.0868 -688.3377 -688.5818 -688.8193 -167.5188 -166.0010 -164.4820 -162.9617 -161.4403 -159.9176 -158.3937 -156.8687 -155.3426 -153.8154 -152.2871 0.7824 0.7824 0.7824 0.7824 0.7824 0.7824 0.7824 0.7824 0.7824 0.7824 0.7824
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
[pos_geo,vel_geo]=states(aircraft.obj,"c","geographic") % expect lat, long, alt=constant, vel=?
pos_geo = 3x11
40.6289 40.6289 40.6289 40.6289 40.6289 40.6289 40.6289 40.6289 40.6289 40.6289 40.6289 -73.7738 -73.7738 -73.7738 -73.7738 -73.7738 -73.7738 -73.7738 -73.7738 -73.7738 -73.7738 -73.7738 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
vel_geo = 3x11
20.7039 21.7069 22.7096 23.7118 24.7135 25.7148 26.7157 27.7160 28.7158 29.7150 30.7137 -705.6223 -705.4838 -705.3386 -705.1866 -705.0279 -704.8625 -704.6903 -704.5114 -704.3258 -704.1335 -703.9345 22.9295 24.0985 25.2671 26.4352 27.6028 28.7698 29.9363 31.1022 32.2675 33.4322 34.5962
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
% When specifying a time for evaluation, velocity behaves as expected
time = datetime(2023,10,9,7,11,0,TimeZone="America/New_York"); % t = 1 min
[~,vel1_ine]=states(aircraft.obj,time)
vel1_ine = 3x1
-328.9145 -129.4914 0.7594
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
[~,vel1_ecef]=states(aircraft.obj,time,"c","ecef")
vel1_ecef = 3x1
1.0e-12 * -0.1137 0.0284 0.0002
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
% vel2_ine should be different than vel1_ine, but norm(vel1_ine) should be equal to norm(vel2_ine)
% vel1_ecef and vel2_ecef should be 0
time = datetime(2023,10,9,7,19,0,TimeZone="America/New_York"); % t = 9 min
[~,vel2_ine]=states(aircraft.obj,time)
vel2_ine = 3x1
-324.1815 -140.9225 0.7490
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
[~,vel2_ecef]=states(aircraft.obj,time,"c","ecef")
vel2_ecef = 3x1
1.0e-13 * 0.5684 0 -0.0011
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
norm(vel1_ine)-norm(vel2_ine)
ans = -5.6843e-14
I agree with you: I am surprised by the velocity results for inertial(=GCRF) and ECEF frames.
I added the geographic frame. The help says veocity is returned in the N-E-D frame, when the reference frame is geographic. Therefore I expect v=0 for this frame. But it is not 0.
I also am surprised that vel1_ine not= vel_ine(:,2), and surprised that vel2_ine not= vel_ine(:,10). Shouldn't those be equal, since they are at the same times and same frames?

サインインしてコメントする。

R2024a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by