- The
ControlledAttitude
class provides a perfectly controlled attitude instead of free motion attitude dynamics by numerical propagation. - Users can set the attitude as sun pointing, earth pointing, and others for any direction in the spacecraft body frame. Of course, users can select an inertial stabilized attitude.
- It is useful for power, communication, and orbit analyses with S2E.
src/dynamics/attitude/attitude.hpp, .cpp
- Definition of
Attitude
base class
- Definition of
src/dynamics/attitude/controlled_attitude.hpp, .cpp
ControlledAttitude
class is defined here.
src/dynamics/attitude/initialize_attitude.hpp, .cpp
- Make an instance of
Attitude
class.
- Make an instance of
sample_satellite.ini
: Initialization file
- Inside the codes
-
ControlledAttitude
class inherits theAttitude
class, so other functions can access theControlledAttitude
class by using get functions in theAttitude
class.
-
- User I/F
- Firstly, users should set
propagate_mode = CONTROLLED
at the[ATTITUDE]
section in thesample_satellite.ini
file. - Users can set a target attitude in the initialize file. There are the following setting parameters:
main_mode
,sub_mode
,initial_quaternion_i2t
,pointing_t_b
, andpointing_sub_t_b
. - Firstly, users select the control mode by using
main_mode
andsub_mode
. For the control mode. - When
main_mode
is set asINERTIAL_STABILIZE
,sub_mode
is ignored, and the spacecraft attitude is fixed to theinitial_quaternion_i2t
value in the simulation. - When
main_mode
is set asHOGE_POINTING
modes, the direction of the body-fixed frame defined bypointing_t_b
is controlled to point the specific direction of the modes.- Ex. 1, the body-fixed +X axis directs to the sun when
main_mode = SUN_POINTING
andpointing_t_b = [1.0,0.0,0.0]
. - Ex. 2, the body-fixed -Z axis directs to the earth center when
main_mode = EARTH_CENTER_POINTING
andpointing_t_b = [0.0,0.0,-1.0]
.
- Ex. 1, the body-fixed +X axis directs to the sun when
-
sub_mode
is only used when users selectPOINTING
modes formain_mode
.sub_mode
is defined to stop rotation around the pointing direction ofmain_mode
. The selected sub-direction in the body-fixed frame cannot perfectly direct the target direction since the primary target and sub-target usually do not satisfy the vertical relationship. -
sub_mode
cannot beINERTIAL_STABILIZE
and the same mode withmain_mode
. - The angle between
pointing_t_b
andpointing_sub_t_b
should be larger than 30 degrees. (90 degrees is recommended)
- Firstly, users should set
- List of attitude control mode
- INERTIAL_STABILIZE = 0
- SUN_POINTING = 1
- EARTH_CENTER_POINTING = 2
- VELOCITY_DIRECTION_POINTING = 3
- ORBIT_NORMAL_POINTING = 4
- orbit normal
$n$ is defined as$n=r\times v$ , where$r$ is radial direction and$v$ is velocity direction.
- This function initializes the target attitude and confirms that the setting parameters are correct.
- The parameter checklist
- Out of range check for both mode definitions.
main_mode
andsub_mode
is not the same- The angle between
pointing_t_b
andpointing_sub_t_b
should be larger than 30 degrees.
- NA
- NA
- NA
- This is the main function executed in every loop of attitude dynamics calculation.
- inputs
- setting parameters
- outputs
- quaternion_i2b
- Detail algorithm is described in the next function.
- NA
- This function calculates the target direction according to the pointing mode.
- inputs
- control mode
- orbit class
- celestial information class
- outputs
- the direction of the target object
- As written in the code.
- NA
- This function calculates the
quaternion_i2b
.
- inputs
- the main direction of the target object in ECI frame
$t_m^i$ - the sub direction of the target object in ECI frame
$t_s^i$ - the main controlled direction in the body frame
$d_m^b$ - the sub controlled direction in the body frame
$d_s^b$
- the main direction of the target object in ECI frame
- outputs
- quaternion_i2b
- Firstly, the
$DCM_{t2i}$ , which is the frame transformation from the target frame to the inertial frame, is calculated using$t_m^i$ and$t_s^i$ withCalcDCM
. - Next, the
$DCM_{t2b}$ , which is the frame transformation from the target frame to the body-fixed frame, is calculated using$d_m^b$ and$d_s^b$ withCalcDCM
. - Finally, both DCMs are combined as follows. And
quaternion_i2b
is calculated from the$DCM_{i2b}$ .
- NA
- This function calculates a DCM from two given directions.
- The DCM represents the coordinate transform matrix from the new frame defined by the two directions to the original frame.
- inputs
- the main direction in the frame
$a$ :$d_m^a$ - the sub direction in the frame
$a$ :$d_s^a$
- the main direction in the frame
- outputs
- Coordinate transform matrix from the new frame to the original frame
$a$
- Coordinate transform matrix from the new frame to the original frame
- The first basis vector of the new frame is defined as the main direction.
- The second basis vector needs to be direct to the sub direction, but it should be vertical with
$e_1$ .
- The third basis vector is defined as right-hand coordinate.
- NA
- Currently, the
ControlledAttitude
class does not calculate angular velocity, and it is set as 0. The feature will be implemented in the near future.
- To verify the correctness of pointing control
- input files
- default files
- initial values
- main_mode = sub_mode = INERTIAL_STABILIZE
- initial_quaternion_i2b = [0.5,0.5,0.5,0.5]
- The inertial stabilize control is succeeded.
- Several cases described at the bottom were checked to verify the correctness of pointing control.
-
input files
- default files
-
cases
case main mode sub mode main_pointing_direction_b sub_pointing_direction_b 1 Sun Earth Center [1,0,0] [0,1,0] 2 Sun Earth Center [0,0,-1] [-1,0,0] 3 Earth Center Velocity [0,-1,0] [0,0,1] 4 Velocity Sun [0.707,0.707,0] [0,0,1]
- Case 1
- The spacecraft +X axis correctly directs to the sun, and its +Y axis roughly directs to the earth.
- Case 2
- The spacecraft -Z axis correctly directs to the sun, and its -X axis roughly directs to the earth.
- Case 3
- The spacecraft -Y axis correctly directs to the earth, and its +Z axis roughly directs to the velocity direction.
- Case 4
- The spacecraft +XY direction correctly directs to the velocity direction, and its +Z axis roughly directs to the sun.
- NA