Spacecraft Control Bundle 1
fsw_attitude_determination_sun_star.h
1/*
2 * Header file for object of class fsw_attitude_determination_sun_star.
3 * Copyright 2010, Princeton Satellite Systems, Inc.
4 * All Rights Reserved.
5 */
6
7#include <ControlDeck2/ControlDeck2.h>
8#import <SCControl/SCControl.h>
9#include "sc_events.h"
10#include "sc_data_names.h"
11
12#ifndef FSW_ATTITUDE_DETERMINATION_SUN_STAR
13#define FSW_ATTITUDE_DETERMINATION_SUN_STAR
14
15
17
21class fsw_attitude_determination_sun_star : public cd_control_module
22{
23 public:
24 fsw_attitude_determination_sun_star (const char * mod_name);
25 void initialize_data();
26 void initialize_data_requests();
27 void initialize();
28 void handle_event(int code);
29
30 protected:
31
35 CD_REQUEST_REF star_id_camera_ref;
37 CD_REQUEST_REF star_data_ref;
39 CD_REQUEST_REF unit_vector_ref;
41 CD_REQUEST_REF u_star_camera_ref;
43 CD_REQUEST_REF camera_rate_meas_ref;
45 CD_REQUEST_REF od_state_ref;
47 CD_REQUEST_REF sun_sensor_pitch_ref;
49 CD_REQUEST_REF sun_sensor_roll_ref;
51 CD_REQUEST_REF magnetometer_ref;
53 CD_REQUEST_REF sun_sensor_valid_ref;
55 CD_REQUEST_REF ephem_sun_vector_ref;
57 CD_REQUEST_REF q_eci_to_body_sim_ref;
59 CD_REQUEST_REF b_field_meas_ref;
61 CD_REQUEST_REF jd_ref;
63 CD_REQUEST_REF meas_stars_ref;
65 CD_REQUEST_REF u_star_catalog_ref;
67
73 CD_CREATE_REF ad_planet_data_ref;
75 CD_CREATE_REF ad_q_eci_to_body_ref;
85
97 CD_CREATE_REF ad_reset_command_ref;
99 CD_CREATE_REF ad_on_command_ref;
119
120 private:
122 UKF ukf_camera;
123
125 UKF2 ukf;
126
128 ml_matrix u_meas_catalog(ml_matrix id, ml_matrix u_catalog);
129
131 ml_matrix q_eci_to_body;
133 ml_matrix gyro_bias_camera;
135 double julian_date_old;
136
138 static ml_matrix meas_fun_ukf (const ml_matrix &x, void *context);
140 static ml_matrix meas_fun_ukf_2 (const ml_matrix &x, void *context);
142 static ml_matrix att_prop( ml_matrix x, double t, void *context);
143
145 void reset_ukf();
146
148 ml_matrix q_eci_to_camera;
150 ml_matrix q_eci_to_camera_single_frame;
151
152 int reset_old;
153
155 typedef struct estimation_struct
156 {
157 double f;
158 ml_matrix q_eci_to_body;
159 ml_matrix u_meas_cat;
160 ml_matrix body_rate;
161 ml_matrix body_rate_bias;
162 ml_matrix spacecraft_r_v;
163 ml_matrix q_body_to_sun_sensor;
164 ml_matrix q_body_to_star_sensor;
165 ml_matrix sun_sensor_id;
166 ml_matrix u_sun_eci;
167 double dT;
168 int use_star_data;
169 int use_sun_data;
170 double julian_date;
171 double row_origin;
172 double col_origin;
173 } EstimationData;
174
175 star_sun_mag_meas_data est_meas_data;
176
177};
178
179extern "C"
180{
181 cd_control_module *fsw_attitude_determination_sun_star_builder(const char *name);
182}
183
184#endif
The attitude determination system using an Unscented Kalman Filter with: star camera,...
Definition: fsw_attitude_determination_sun_star.h:22
CD_CREATE_REF ad_sun_meas_noise_covariance_command_ref
Sun sensor measurement noise.
Definition: fsw_attitude_determination_sun_star.h:117
CD_CREATE_REF ad_parameter_command_ref
The [alpha, kappa, and beta] parameters.
Definition: fsw_attitude_determination_sun_star.h:101
CD_CREATE_REF ad_use_sun_data_command_ref
Select sun sensor data.
Definition: fsw_attitude_determination_sun_star.h:115
CD_CREATE_REF ad_q_eci_to_camera_single_frame_ref
Single frame ad camera.
Definition: fsw_attitude_determination_sun_star.h:81
CD_CREATE_REF ad_meas_sun_noise_covariance_command_ref
UKF measurement noise covariance.
Definition: fsw_attitude_determination_sun_star.h:109
CD_CREATE_REF ad_use_single_frame_command_ref
Use single frame camera solutions.
Definition: fsw_attitude_determination_sun_star.h:95
CD_REQUEST_REF sun_sensor_roll_ref
Sun sensor roll measurement.
Definition: fsw_attitude_determination_sun_star.h:49
CD_CREATE_REF camera_data_command_ref
Camera data.
Definition: fsw_attitude_determination_sun_star.h:89
CD_CREATE_REF ad_q_eci_to_camera_ref
Single frame ad camera.
Definition: fsw_attitude_determination_sun_star.h:83
CD_CREATE_REF ad_initial_covariance_command_ref
UKF initial covariance.
Definition: fsw_attitude_determination_sun_star.h:103
CD_CREATE_REF ad_meas_star_noise_covariance_command_ref
UKF measurement noise covariance.
Definition: fsw_attitude_determination_sun_star.h:107
CD_REQUEST_REF unit_vector_ref
Star catalog unit vectors.
Definition: fsw_attitude_determination_sun_star.h:39
CD_CREATE_REF ad_use_star_data_command_ref
Select star data.
Definition: fsw_attitude_determination_sun_star.h:113
CD_REQUEST_REF u_star_camera_ref
Unit vectors for identified stars.
Definition: fsw_attitude_determination_sun_star.h:41
CD_REQUEST_REF sun_sensor_valid_ref
Sun sensor data validity flag.
Definition: fsw_attitude_determination_sun_star.h:53
CD_CREATE_REF ad_q_body_to_camera_ref
Q ECI to Body from the simulation.
Definition: fsw_attitude_determination_sun_star.h:71
CD_CREATE_REF ad_q_body_to_star_sensor_ref
Quaternion from body to the sun sensor.
Definition: fsw_attitude_determination_sun_star.h:93
CD_REQUEST_REF meas_stars_ref
Measurements.
Definition: fsw_attitude_determination_sun_star.h:63
CD_REQUEST_REF q_eci_to_body_sim_ref
Q ECI to Body from the simulation.
Definition: fsw_attitude_determination_sun_star.h:57
CD_CREATE_REF ad_planet_data_ref
Q ECI to Body from the simulation.
Definition: fsw_attitude_determination_sun_star.h:73
CD_CREATE_REF ad_covariance_camera_ref
AD covariance.
Definition: fsw_attitude_determination_sun_star.h:79
CD_REQUEST_REF b_field_meas_ref
B field.
Definition: fsw_attitude_determination_sun_star.h:59
CD_CREATE_REF ad_reset_command_ref
Attitude determination commands.
Definition: fsw_attitude_determination_sun_star.h:97
CD_CREATE_REF ad_gyro_bias_camera_ref
Gyro bias estimated.
Definition: fsw_attitude_determination_sun_star.h:77
CD_REQUEST_REF jd_ref
Julian date.
Definition: fsw_attitude_determination_sun_star.h:61
CD_REQUEST_REF star_id_camera_ref
Identified stars.
Definition: fsw_attitude_determination_sun_star.h:35
CD_REQUEST_REF sun_sensor_pitch_ref
Sun sensor pitch measurement.
Definition: fsw_attitude_determination_sun_star.h:47
CD_CREATE_REF ad_q_eci_to_body_ref
Quaternion from eci to body estimated.
Definition: fsw_attitude_determination_sun_star.h:75
CD_CREATE_REF ad_initial_state_command_ref
UKF initial state.
Definition: fsw_attitude_determination_sun_star.h:111
CD_CREATE_REF ad_plant_noise_covariance_command_ref
UKF plant noise covariance.
Definition: fsw_attitude_determination_sun_star.h:105
void handle_event(int code)
Definition: fsw_attitude_determination_sun_star.cc:136
CD_REQUEST_REF od_state_ref
Spacecraft state [r;v] od_state.
Definition: fsw_attitude_determination_sun_star.h:45
CD_CREATE_REF ad_on_command_ref
Attitude determination on command.
Definition: fsw_attitude_determination_sun_star.h:99
CD_REQUEST_REF ephem_sun_vector_ref
Sun vector.
Definition: fsw_attitude_determination_sun_star.h:55
void initialize_data()
Create data and request the FSW_ATTITUDE_DETERMINATION_TRIGGER.
Definition: fsw_attitude_determination_sun_star.cc:19
CD_REQUEST_REF camera_rate_meas_ref
Measured camera rate.
Definition: fsw_attitude_determination_sun_star.h:43
CD_REQUEST_REF u_star_catalog_ref
Corresponding catalog unit vectors.
Definition: fsw_attitude_determination_sun_star.h:65
CD_REQUEST_REF star_data_ref
Star data.
Definition: fsw_attitude_determination_sun_star.h:37
CD_CREATE_REF ad_q_body_to_sun_sensor_ref
Quaternion from body to the sun sensor.
Definition: fsw_attitude_determination_sun_star.h:91
CD_REQUEST_REF magnetometer_ref
Magnetometer measurements.
Definition: fsw_attitude_determination_sun_star.h:51
Define the data names used throughout the control system.
const SC_DATA julian_date
Julian date.
Definition: sc_data_names.h:82
Define the trigger and variables names for the software system.