Platform velocity different than 0 in ECEF coordinates
6 views (last 30 days)
Show older comments
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 Comment
William Rose
on 8 May 2024
Edited: William Rose
on 8 May 2024
@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.
Answers (1)
William Rose
on 8 May 2024
%% 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: expect pos=constant, vel=0
[pos_geo,vel_geo]=states(aircraft.obj,"c","geographic") % expect lat, long, alt=constant, vel=?
% 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)
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?
0 Comments
See Also
Categories
Find more on Axes Transformations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!