<< Cookbook Cookbook Numerical integration of orbital motion >>

celestlab >> - Introduction - > Cookbook > Frame transformations

Frame transformations

Frame transformations

Example: transformation from "launch frame" to ECI

Orbital elements are supposed known in a terrestrial frame "frozen" at a given time (called "launch" frame) defined by:

This frame is sometimes called "H0-n", where n is the number of seconds before lift-off.

The question is then: "what are the orbital elements in ECI?".

The following example shows two different ways for obtaining the results.

// ------------
// HYPOTHESES
// ------------
// Date/time of frame supposed in TREF time scale: 
cjd0 = CL_dat_cal2cjd(2012, 12, 01, 06, 00, 00);

// Longitude defining the X axis: 
lon0 = CL_deg2rad(-15); 

// Orbital elements (sma, ecc, inc, argp, raan, mean anomaly) 
// in launch frame: 
kep_launch = [7000.e3; 0.1; 1; 0; 0.1; 0];
 
 
// ------------------------
// METHOD 1: using transformation matrices 
// Note that all frames are fixed with respect to each other
// (All velocities are relative to ECI)  
// ------------------------

// Conversion to position and velocity:
[pos_launch, vel_launch] = CL_oe_kep2car(kep_launch); 

// Frame transformation matrix: ECF to "launch frame":
M1 = CL_rot_angles2matrix(3, lon0); 

// Frame transformation matrix: "ECF" to "ECI" at cjd0:
M2 = CL_fr_convertMat("ECF", "ECI", cjd0); 

// Composition of frame transformations (no relative angular velocities): 
// "launch frame" -> ECF followed by:  ECF -> ECI
[M, omega] = CL_rot_compose(M1, [0;0;0], -1, M2, [0;0;0], 1); 

// omega is [0;0;0], but we can still use: 
[pos_eci, vel_eci] = CL_rot_pvConvert(pos_launch, vel_launch, M, omega); 

// Or:
// M = M2 * M1'
// pos_eci = M * pos_launch 
// vel_eci = M * vel_launch 

// Convert to orbital elements: 
kep_eci = CL_oe_car2kep(pos_eci, vel_eci); 

// All elements are the same as in kep_launch except RAAN 
disp(kep_eci); 
 
 
// ------------------------
// METHOD 2: direct way 
// ------------------------
// RAAN relative to launch frame  
raan_launch = kep_launch(5);

// Sidereal time at cjd0 (rotation from ECI to ECF)
sid_time0 = CL_mod_siderealTime(cjd0); 

// RAAN relative to ECI
raan_eci = raan_launch + sid_time0 + lon0; 

// Comparison with previous result (RAAN only)
disp(CL_rMod(raan_eci - kep_eci(5), -%pi, %pi));


Report an issue
<< Cookbook Cookbook Numerical integration of orbital motion >>