- https://www.mathworks.com/help/satcom/ref/matlabshared.satellitescenario.satellite.aer.html - Refer to the example and the description of the Input arguments.
- https://www.mathworks.com/help/satcom/ref/matlabshared.satellitescenario.satellite.pointat.html#mw_b2494088-9480-44e6-8f4f-cec72e298f81 – refer to the Name-Value pair arguments section.
Need attitude of a Satellite that is pointing at a target
13 views (last 30 days)
Show older comments
I would like to do the following:
-provide a target to point at
-use pointAt(sat,target)
-output attitude of satellite during access time.
I spent all day scouring the internet and could not find an answer to the following question:
How can I get the attitude of my sat during a specific scenario time or in a timetable?
I do not want to use simulink.
what I have tried...code below.
I can use accessIntervals to obtain the times. And aer func. to provide the elevation, azimuth, and range from sat to ground point.
but when I use the azimuth and elevation as euler rotations on the sat in NED, again using pointAt(sat,gs,AttitudeTimeTable), I get close, but something is off. it is inconsistent over more than one orbit and does not match the standard pointAt function that doesn't use defined attitude data.
%pointAt(sat(1),gs(1)) works perfectly. Except I need the attitude data.
%and I want to switch between ground points of interest during an orbit. So
%I have attempted to convert the azimuth and elevation to euler rotations
%in the NED frame.
[az,el,range,timeout] = aer(gs(1),sat(1),coordinateFrame='body');
d= 1;
%delete non-access times. too much data and not useful.
for i = 1:length(Status)
if Status(i) == 0
toDelete(d) = i;
d=d+1;
end
end
az(toDelete) = [];
el(toDelete) = [];
range(toDelete)= [];
timeout(toDelete)=[];
timeout = transpose(timeout);
%transpose to build time table
az = transpose(az);
el= transpose(el);
z= zeros(length(az),1);
%modify az and el, set zeros
ROTz= az - 15; %-15deg for the half angle of the connical sensor cone
ROTy= -el; % negative because for some reason, 'body' coordinate fram of aer() returns a negative angle if z-component is in positive z-direction.
ROTx= z; %zeros because only need to rotate two axis to point.
%angle rotation array
ROTxyz = [ROTx,ROTy,ROTz];
%build time table
TT = timetable(timeout,ROTxyz); %stated that euler rotations should be in "ZYX" format in matlab documentation (i think matlab is wrong)
pointAt(sat(1),TT,Format="euler",CoordinateFrame="ned")
%results not consistant with standard pointAt function that
%doesn't use attitude timetable.
0 Comments
Answers (1)
Garmit Pant
on 25 Sep 2023
Hello Garrett
I understand that you are trying to obtain the attitude information of your satellite at a specific time scenario, and you want to use the attitude information as the target for the satellite to point at.
The MATLAB function ‘aer’ is used to extract the azimuth angle, elevation angle and the range between an asset and a target. You can provide the third input argument as a ‘datetime’ variable ‘timeIn’ to find the azimuth, elevation, and range at the specific time.
%code to find the azimuth and elevation angle and range of the ground station ‘gs(1)’ with respect to the satellite ‘sat (1) on April 25, 2021, 1:26 AM UTC.
timeIn = datetime (2021,4,25,1,26,0);
[az,el,range] = aer(sat(1),gs(1),timeIn, coordinateFrame = ‘ned’);
To point the satellite at the ground station using the attitude information, you need to create a MATLAB ‘timetable’ with one column as row times and for a single satellite. The table must contain one data column of scalar-first quaternions [1-by-4] or ZYX Euler angles [1-by-3]. Please note that the documentation very specifically states the Euler angles to be in ‘ZYX’ rotation sequence.
You need to convert the azimuth and elevation angles obtained using function ‘aer’ to rotation angles and then create the timetable with these angles in ZYX sequence to pass the timetable as an argument to the function ‘pointAt’.
The inconsistencies can be arising due to inconsistent selection of coordinate frames. Please check that the angles calculated in a specific coordinate frame need to be changed accordingly before passing to another function calculating in another coordinate frame.
For further understanding, you can refer to the following MATLAB Documentation:
I hope this helps!
Best Regards
Garmit
0 Comments
See Also
Categories
Find more on Satellite Mission Analysis 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!