Spacecraft Control Bundle 1
fsw_attitude_control Class Reference

A PID based attitude control system. More...

#include <fsw_attitude_control.h>

Inheritance diagram for fsw_attitude_control:

Public Member Functions

 fsw_attitude_control (const char *mod_name)
 
void initialize_data ()
 Create data and request the FSW_ATTITUDE_CONTROL_TRIGGER. More...
 
void initialize_data_requests ()
 
void handle_event (int code)
 
int valid_quaternion (ml_matrix q)
 Checks the validity of a quaternion. More...
 
int valid_vector (ml_matrix u)
 Checks the validity of a unit vector. More...
 
ml_matrix make_unit_vector (ml_matrix u)
 Make a unit vector. More...
 
int get_index (int id, ml_matrix index_list)
 Get the index for the SPICE id. More...
 

Protected Attributes

Inputs


CD_REQUEST_REF od_state_ref
 State estimate od_state. More...
 
CD_REQUEST_REF inertia_ref
 The spacecraft inertia matrix. More...
 
CD_REQUEST_REF quaternion_ref
 The estimated quaternion. More...
 
CD_REQUEST_REF omega_ref
 The estimated body rate. More...
 
CD_REQUEST_REF ephem_planet_position_ref
 Planet position. More...
 
CD_REQUEST_REF ephem_planet_index_ref
 Planet index. More...
 
CD_REQUEST_REF ephem_planet_rotation_matrix_ref
 Planet rotation matrix. More...
 
CD_REQUEST_REF ephem_planet_radius_ref
 Planet radius. More...
 
CD_REQUEST_REF ephem_sun_vector_ref
 Sun vector. More...
 
Outputs
CD_CREATE_REF acs_error_ref
 ACS error code (int) More...
 
CD_CREATE_REF acs_attitude_error_ref
 Attitude error (3x1) More...
 
CD_CREATE_REF acs_torque_demand_ref
 The torque demand for all attitude control (3x1) More...
 
CD_CREATE_REF acs_target_quaternion_ref
 Desired quaternion (4x1) More...
 
ACS Parameters and Commands


CD_CREATE_REF acs_q_eci_to_body_command_ref
 
CD_CREATE_REF acs_omega_command_ref
 Commanded angular rate for rate control (3x1) More...
 
CD_CREATE_REF acs_axis_rate_command_ref
 Commanded axis rate. More...
 
CD_CREATE_REF acs_eci_align_axis_command_ref
 The eci axis to be aligned (3x1) More...
 
CD_CREATE_REF acs_body_align_axis_command_ref
 The body axis to be aligned (3x1) More...
 
CD_CREATE_REF acs_rotate_axis_command_ref
 The axis to be rotated about (3x1) More...
 
CD_CREATE_REF acs_rotate_angle_command_ref
 The angle to be rotated (double) More...
 
CD_CREATE_REF acs_control_mode_command_ref
 Select the control mode (int) More...
 
CD_CREATE_REF acs_solar_system_target_command_ref
 Solar system target. Format: integer SPICE ID. More...
 
CD_CREATE_REF acs_attitude_gain_a_command_ref
 The ACS control algorithm state space gain a matrix. More...
 
CD_CREATE_REF acs_attitude_gain_b_command_ref
 The ACS control algorithm state space gain b matrix. More...
 
CD_CREATE_REF acs_attitude_gain_c_command_ref
 The ACS control algorithm state space gain c matrix. More...
 
CD_CREATE_REF acs_attitude_gain_d_command_ref
 The ACS control algorithm state space gain d matrix. More...
 
CD_CREATE_REF acs_planet_target_command_ref
 Planet target. More...
 
CD_CREATE_REF acs_body_rate_gain_command_ref
 The scalar body rate gain (double) More...
 
CD_CREATE_REF acs_q_nadir_offset_command_ref
 Nadir offset (4x1) More...
 
CD_CREATE_REF acs_control_period_command_ref
 ACS control period (double) More...
 
CD_CREATE_REF acs_maximum_delta_angle_command_ref
 Desired maximum delta angle (double) More...
 

Detailed Description

A PID based attitude control system.

The attitude control system takes inputs from attitude estimation and uses it to control pointing. The control system can control body rates, rotate about a specified axis, align a body axis with an inertial axis, track an attitude quaternion, align a body axis with a planet fixed target or do the last while rotating about that planet aligned axis.

You can compute the gain matrices using

[a,b,c,d] = PIDMIMO( 1, zeta, omega, tau_integral, omega_rolloff, t_samp, 'z' )

from the Spacecraft Control Toolbox (in MATLAB). omega_rolloff is a first order rate filter break frequency. 'z' implies that the controller equations are x[k+1] = a*x[k] + b*u[k]

The output is the torque demand. This is processed by the propulsion module.

You must also input the vehicle inertia matrix. It may be necessary to update the torque matrix and inertia matrix as fuel is consumed or when mass properties change.

The following are the pointing modes:

  • off: Turn off the attitude control system.
  • quaternion_tracking: Track a desire quaternion.
  • rate_tracking: Control rates.
  • axis_align: Align a vector in the body along an ECI vector.
  • single_axis_rotate: Rotate about a body axis
  • solar_system_body_align: Align a vector in the body with a planet or moon.
  • solar_system_body_align_and_rotate: Align a vector in the body with a planet or moon and rotate about that vector.
  • axis_align_and_rotate: Align a vector in the body along an ECI vector and rotate about that vector.
  • sun_tracking: Align a vector in the body with the sun.
  • nadir_tracking: Align a vector in the body with nadir

Member Function Documentation

◆ get_index()

int fsw_attitude_control::get_index ( int  id,
ml_matrix  index_list 
)

Get the index for the SPICE id.

◆ initialize_data()

◆ make_unit_vector()

ml_matrix fsw_attitude_control::make_unit_vector ( ml_matrix  u)

Make a unit vector.

◆ valid_quaternion()

int fsw_attitude_control::valid_quaternion ( ml_matrix  q)

Checks the validity of a quaternion.

◆ valid_vector()

int fsw_attitude_control::valid_vector ( ml_matrix  u)

Checks the validity of a unit vector.

Member Data Documentation

◆ acs_attitude_error_ref

CD_CREATE_REF fsw_attitude_control::acs_attitude_error_ref
protected

Attitude error (3x1)

Referenced by initialize_data().

◆ acs_error_ref

CD_CREATE_REF fsw_attitude_control::acs_error_ref
protected

ACS error code (int)

  • 0 = no error
  • 1 = no such mode
  • 2 = axis align error
  • 3 = single axis rotate error
  • 4 = solar system align error

Referenced by initialize_data().

◆ acs_target_quaternion_ref

CD_CREATE_REF fsw_attitude_control::acs_target_quaternion_ref
protected

Desired quaternion (4x1)

Referenced by initialize_data().

◆ acs_torque_demand_ref

CD_CREATE_REF fsw_attitude_control::acs_torque_demand_ref
protected

The torque demand for all attitude control (3x1)

Referenced by initialize_data().

◆ ephem_planet_index_ref

CD_REQUEST_REF fsw_attitude_control::ephem_planet_index_ref
protected

Planet index.

◆ ephem_planet_position_ref

CD_REQUEST_REF fsw_attitude_control::ephem_planet_position_ref
protected

Planet position.

◆ ephem_planet_radius_ref

CD_REQUEST_REF fsw_attitude_control::ephem_planet_radius_ref
protected

Planet radius.

◆ ephem_planet_rotation_matrix_ref

CD_REQUEST_REF fsw_attitude_control::ephem_planet_rotation_matrix_ref
protected

Planet rotation matrix.

◆ ephem_sun_vector_ref

CD_REQUEST_REF fsw_attitude_control::ephem_sun_vector_ref
protected

Sun vector.

◆ inertia_ref

CD_REQUEST_REF fsw_attitude_control::inertia_ref
protected

The spacecraft inertia matrix.

◆ od_state_ref

CD_REQUEST_REF fsw_attitude_control::od_state_ref
protected

State estimate od_state.

◆ omega_ref

CD_REQUEST_REF fsw_attitude_control::omega_ref
protected

The estimated body rate.

◆ quaternion_ref

CD_REQUEST_REF fsw_attitude_control::quaternion_ref
protected

The estimated quaternion.


The documentation for this class was generated from the following files: