Spacecraft Control Bundle 1
fsw_attitude_control.h
1/*
2 * Header file for object of class fsw_attitude_control.
3 * Copyright 2008-2010 Princeton Satellite Systems, Inc.
4 * All Rights Reserved.
5 */
6
7#include <ControlDeck2/ControlDeck2.h>
8#include <SCControl/SCControl.h>
9
10#ifndef FSW_ATTITUDE_CONTROL
11#define FSW_ATTITUDE_CONTROL
12
44class fsw_attitude_control : public cd_control_module
45{
46 public:
47 fsw_attitude_control (const char * mod_name);
48 void initialize_data();
49 void initialize_data_requests();
50 void handle_event(int code);
52 int valid_quaternion( ml_matrix q );
54 int valid_vector( ml_matrix u );
56 ml_matrix make_unit_vector( ml_matrix u );
58 int get_index( int id, ml_matrix index_list );
59
60
61 protected:
62
65 CD_REQUEST_REF od_state_ref;
66 CD_REQUEST_REF inertia_ref;
67 CD_REQUEST_REF quaternion_ref;
68 CD_REQUEST_REF omega_ref;
70 CD_REQUEST_REF ephem_planet_index_ref;
72 CD_REQUEST_REF ephem_planet_radius_ref;
73 CD_REQUEST_REF ephem_sun_vector_ref;
75
85 CD_CREATE_REF acs_error_ref;
89 CD_CREATE_REF acs_torque_demand_ref;
93
134
135 private:
136 // Attitude Control Class
137 PID3Axis pid;
138
139 // Initialization flag
140 int init_pid;
141
142 int acs_error;
143
144 int control_mode_command_old;
145
146 double axis_angle;
147
148
149};
150
151extern "C"
152{
153 cd_control_module *fsw_attitude_control_builder(const char *name);
154}
155
156#endif
A PID based attitude control system.
Definition: fsw_attitude_control.h:45
CD_REQUEST_REF inertia_ref
The spacecraft inertia matrix.
Definition: fsw_attitude_control.h:66
CD_REQUEST_REF omega_ref
The estimated body rate.
Definition: fsw_attitude_control.h:68
ml_matrix make_unit_vector(ml_matrix u)
Make a unit vector.
Definition: fsw_attitude_control.cc:505
int valid_vector(ml_matrix u)
Checks the validity of a unit vector.
Definition: fsw_attitude_control.cc:493
CD_CREATE_REF acs_attitude_error_ref
Attitude error (3x1)
Definition: fsw_attitude_control.h:87
int valid_quaternion(ml_matrix q)
Checks the validity of a quaternion.
Definition: fsw_attitude_control.cc:481
CD_REQUEST_REF ephem_planet_radius_ref
Planet radius.
Definition: fsw_attitude_control.h:72
void initialize_data()
Create data and request the FSW_ATTITUDE_CONTROL_TRIGGER.
Definition: fsw_attitude_control.cc:22
int get_index(int id, ml_matrix index_list)
Get the index for the SPICE id.
Definition: fsw_attitude_control.cc:518
CD_REQUEST_REF od_state_ref
State estimate od_state.
Definition: fsw_attitude_control.h:65
CD_REQUEST_REF quaternion_ref
The estimated quaternion.
Definition: fsw_attitude_control.h:67
CD_REQUEST_REF ephem_planet_index_ref
Planet index.
Definition: fsw_attitude_control.h:70
CD_CREATE_REF acs_torque_demand_ref
The torque demand for all attitude control (3x1)
Definition: fsw_attitude_control.h:89
CD_REQUEST_REF ephem_sun_vector_ref
Sun vector.
Definition: fsw_attitude_control.h:73
CD_REQUEST_REF ephem_planet_rotation_matrix_ref
Planet rotation matrix.
Definition: fsw_attitude_control.h:71
CD_CREATE_REF acs_error_ref
ACS error code (int)
Definition: fsw_attitude_control.h:85
CD_REQUEST_REF ephem_planet_position_ref
Planet position.
Definition: fsw_attitude_control.h:69
CD_CREATE_REF acs_target_quaternion_ref
Desired quaternion (4x1)
Definition: fsw_attitude_control.h:91
CD_CREATE_REF acs_solar_system_target_command_ref
Solar system target. Format: integer SPICE ID.
Definition: fsw_attitude_control.h:114
CD_CREATE_REF acs_body_rate_gain_command_ref
The scalar body rate gain (double)
Definition: fsw_attitude_control.h:126
CD_CREATE_REF acs_attitude_gain_b_command_ref
The ACS control algorithm state space gain b matrix.
Definition: fsw_attitude_control.h:118
CD_CREATE_REF acs_q_eci_to_body_command_ref
Definition: fsw_attitude_control.h:98
CD_CREATE_REF acs_control_period_command_ref
ACS control period (double)
Definition: fsw_attitude_control.h:130
CD_CREATE_REF acs_eci_align_axis_command_ref
The eci axis to be aligned (3x1)
Definition: fsw_attitude_control.h:104
CD_CREATE_REF acs_rotate_axis_command_ref
The axis to be rotated about (3x1)
Definition: fsw_attitude_control.h:108
CD_CREATE_REF acs_body_align_axis_command_ref
The body axis to be aligned (3x1)
Definition: fsw_attitude_control.h:106
CD_CREATE_REF acs_q_nadir_offset_command_ref
Nadir offset (4x1)
Definition: fsw_attitude_control.h:128
CD_CREATE_REF acs_attitude_gain_c_command_ref
The ACS control algorithm state space gain c matrix.
Definition: fsw_attitude_control.h:120
CD_CREATE_REF acs_planet_target_command_ref
Planet target.
Definition: fsw_attitude_control.h:124
CD_CREATE_REF acs_attitude_gain_a_command_ref
The ACS control algorithm state space gain a matrix.
Definition: fsw_attitude_control.h:116
CD_CREATE_REF acs_rotate_angle_command_ref
The angle to be rotated (double)
Definition: fsw_attitude_control.h:110
CD_CREATE_REF acs_axis_rate_command_ref
Commanded axis rate.
Definition: fsw_attitude_control.h:102
CD_CREATE_REF acs_omega_command_ref
Commanded angular rate for rate control (3x1)
Definition: fsw_attitude_control.h:100
CD_CREATE_REF acs_control_mode_command_ref
Select the control mode (int)
Definition: fsw_attitude_control.h:112
CD_CREATE_REF acs_attitude_gain_d_command_ref
The ACS control algorithm state space gain d matrix.
Definition: fsw_attitude_control.h:122
CD_CREATE_REF acs_maximum_delta_angle_command_ref
Desired maximum delta angle (double)
Definition: fsw_attitude_control.h:132