Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NASA Monte Carlo #351

Open
govindchari opened this issue Jan 5, 2022 · 4 comments
Open

NASA Monte Carlo #351

govindchari opened this issue Jan 5, 2022 · 4 comments

Comments

@govindchari
Copy link
Member

govindchari commented Jan 5, 2022

We need to report coordinates in J2000 MEME Format

PSim propagates in ECEF without precession terms, so it is slightly inaccurate, but is fine to propagate with for a week

However, we need to reinitialize a few parameters (quat_ecef0_eci and precession rate) with the values from the current day

There is a matlab script in the MATLAB/ folder titled config.m that does this. Just put in the date on line 35 and the parameters are computed in lines 62 and 64.

There is also a PR open that will allow these inputs to be put into the config file of psim

When running the Monte Carlo, we should also reseed the config file

This time reset breaks attitude stuff since the magnetic field and sun vectors are time varying

To fix this, look at lines 44 and 52 in psim/truth/environment.cpp. A delta needs to be added to t to compensate for the time since the PAN epoch

@nhz2
Copy link
Member

nhz2 commented Jan 6, 2022

Take a look at https://github.com/pathfinder-for-autonomous-navigation/psim/blob/13824dfb94d07a672ce1e97e89e205b815bf1584/MATLAB/environmental_models/helper_functions/eci_ecef_conversions.py if you want an example of converting between ECEF and ECI with astropy and GPS time. The eci ecef stuff in MATLAB/config.m is just a rough conversion that is good enough for attitude estimation and control, but has some issues.

Also, the date on line 35 of MATLAB/config.m is the date when the earth was at perihelion in 2019, its used for the simplified sun vector model. http://www.astropixels.com/ephemeris/perap2001.html has some other perihelion dates.

Change the initial GPS week number:

const.INITGPS_WN= 2045;% positive int

To update const.INIT_DYEARwhich is used in the magnetic field model:
const.INIT_DYEAR= decyear(utl_time2datetime(0.0,const.INITGPS_WN));

const.tp_earth which is used in the sun vector model:

const.tp_earth = utl_datetime2time(perihelion_date,const.INITGPS_WN);

And the other parameters used in the rough earth rotation model.

psim/MATLAB/config.m

Lines 57 to 65 in 13824df

T0=utl_time2datetime(0,const.INITGPS_WN);%pan epoch
T5=T0+years(5);%5 years after pan epoch
dcm_ECEF0_ECI=dcmeci2ecef('IAU-2000/2006',[year(T0),month(T0),day(T0),hour(T0),minute(T0),second(T0)]);
dcm_ECEF5_ECI=dcmeci2ecef('IAU-2000/2006',[year(T5),month(T5),day(T5),hour(T5),minute(T5),second(T5)]);
polarprecessionaxis= -cross((dcm_ECEF0_ECI*dcm_ECEF5_ECI'*[0;0;1;]),[0;0;1;]);
const.PRECESSION_RATE= polarprecessionaxis/seconds(T5-T0);% 3 vector
% earth's axis precession rate (rad/s)
const.quat_ecef0_eci= utl_quaternion2array(quaternion(dcm_ECEF0_ECI,'rotmat','frame'));
%ecef0 is ecef frame at time 0 inertialy stuck.

@shihaocao
Copy link
Collaborator

@nhz2 @govindchari Is it possible to just run the python script that Nathan linked instead of the Matlab script? The ground server will not be able to easily run MatLab scripts.

@shihaocao
Copy link
Collaborator

https://docs.astropy.org/en/stable/time/index.html#convert-time-scale
Use this for time dump into utc

@shihaocao
Copy link
Collaborator

TODO folder login dump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants