Spacecraft Control Bundle 1
fsw_attitude_determination_multi_sensor.h
1/*
2 * Header file for object of class fsw_attitude_determination_multi_sensor.
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_MULTI_SENSOR
13#define FSW_ATTITUDE_DETERMINATION_MULTI_SENSOR
14
15
17
21class fsw_attitude_determination_multi_sensor : public cd_control_module
22{
23 public:
24 fsw_attitude_determination_multi_sensor (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
99 CD_CREATE_REF ad_reset_command_ref;
101 CD_CREATE_REF ad_on_command_ref;
127
128 private:
130 UKF ukf_camera;
131
133 UKF2 ukf;
134
136 ml_matrix u_meas_catalog(ml_matrix id, ml_matrix u_catalog);
137
139 ml_matrix q_eci_to_body;
141 ml_matrix gyro_bias_camera;
143 double julian_date_old;
144
146 static ml_matrix meas_fun_ukf (const ml_matrix &x, void *context);
148 static ml_matrix meas_fun_ukf_2 (const ml_matrix &x, void *context);
150 static ml_matrix att_prop( ml_matrix x, double t, void *context);
151
153 void reset_ukf();
154
156 ml_matrix q_eci_to_camera;
158 ml_matrix q_eci_to_camera_single_frame;
159
160 int reset_old;
161
163 typedef struct estimation_struct
164 {
165 double f;
166 ml_matrix q_eci_to_body;
167 ml_matrix u_meas_cat;
168 ml_matrix body_rate;
169 ml_matrix body_rate_bias;
170 ml_matrix spacecraft_r_v;
171 ml_matrix q_body_to_magnetometer;
172 ml_matrix q_body_to_sun_sensor;
173 ml_matrix q_body_to_star_sensor;
174 ml_matrix sun_sensor_id;
175 ml_matrix u_sun_eci;
176 double dT;
177 int use_star_data;
178 int use_sun_data;
179 int use_magnetometer_data;
180 double julian_date;
181 double row_origin;
182 double col_origin;
183 } EstimationData;
184
185 star_sun_mag_meas_data est_meas_data;
186
187};
188
189extern "C"
190{
191 cd_control_module *fsw_attitude_determination_multi_sensor_builder(const char *name);
192}
193
194#endif
The attitude determination system using an Unscented Kalman Filter with: star camera,...
Definition: fsw_attitude_determination_multi_sensor.h:22
CD_CREATE_REF ad_q_eci_to_body_ref
Quaternion from eci to body estimated.
Definition: fsw_attitude_determination_multi_sensor.h:75
CD_CREATE_REF ad_covariance_camera_ref
AD covariance.
Definition: fsw_attitude_determination_multi_sensor.h:79
CD_REQUEST_REF jd_ref
Julian date.
Definition: fsw_attitude_determination_multi_sensor.h:61
void handle_event(int code)
Definition: fsw_attitude_determination_multi_sensor.cc:146
CD_CREATE_REF ad_q_body_to_camera_ref
Q ECI to Body from the simulation.
Definition: fsw_attitude_determination_multi_sensor.h:71
CD_CREATE_REF ad_use_star_data_command_ref
Select star data.
Definition: fsw_attitude_determination_multi_sensor.h:117
CD_CREATE_REF ad_parameter_command_ref
The [alpha, kappa, and beta] parameters.
Definition: fsw_attitude_determination_multi_sensor.h:103
CD_CREATE_REF ad_on_command_ref
Attitude determination on command.
Definition: fsw_attitude_determination_multi_sensor.h:101
CD_CREATE_REF ad_initial_covariance_command_ref
UKF initial covariance.
Definition: fsw_attitude_determination_multi_sensor.h:105
CD_CREATE_REF ad_initial_state_command_ref
UKF initial state.
Definition: fsw_attitude_determination_multi_sensor.h:115
CD_REQUEST_REF star_data_ref
Star data.
Definition: fsw_attitude_determination_multi_sensor.h:37
CD_CREATE_REF camera_data_command_ref
Camera data.
Definition: fsw_attitude_determination_multi_sensor.h:89
CD_REQUEST_REF od_state_ref
Spacecraft state [r;v] od_state.
Definition: fsw_attitude_determination_multi_sensor.h:45
CD_REQUEST_REF meas_stars_ref
Measurements.
Definition: fsw_attitude_determination_multi_sensor.h:63
CD_CREATE_REF ad_use_magnetometer_data_command_ref
Select magnetometer data.
Definition: fsw_attitude_determination_multi_sensor.h:119
CD_REQUEST_REF b_field_meas_ref
B field.
Definition: fsw_attitude_determination_multi_sensor.h:59
CD_REQUEST_REF u_star_catalog_ref
Corresponding catalog unit vectors.
Definition: fsw_attitude_determination_multi_sensor.h:65
CD_REQUEST_REF sun_sensor_roll_ref
Sun sensor roll measurement.
Definition: fsw_attitude_determination_multi_sensor.h:49
CD_REQUEST_REF star_id_camera_ref
Identified stars.
Definition: fsw_attitude_determination_multi_sensor.h:35
CD_REQUEST_REF camera_rate_meas_ref
Measured camera rate.
Definition: fsw_attitude_determination_multi_sensor.h:43
CD_CREATE_REF ad_use_sun_data_command_ref
Select sun sensor data.
Definition: fsw_attitude_determination_multi_sensor.h:121
CD_CREATE_REF ad_reset_command_ref
Attitude determination commands.
Definition: fsw_attitude_determination_multi_sensor.h:99
CD_REQUEST_REF q_eci_to_body_sim_ref
Q ECI to Body from the simulation.
Definition: fsw_attitude_determination_multi_sensor.h:57
CD_CREATE_REF ad_q_body_to_sun_sensor_ref
Quaternion from body to the sun sensor.
Definition: fsw_attitude_determination_multi_sensor.h:93
CD_CREATE_REF ad_meas_sun_noise_covariance_command_ref
UKF measurement noise covariance.
Definition: fsw_attitude_determination_multi_sensor.h:111
CD_REQUEST_REF u_star_camera_ref
Unit vectors for identified stars.
Definition: fsw_attitude_determination_multi_sensor.h:41
CD_CREATE_REF ad_q_body_to_magnetometer_ref
Quaternion from body to the magnetometer frame.
Definition: fsw_attitude_determination_multi_sensor.h:91
CD_REQUEST_REF sun_sensor_pitch_ref
Sun sensor pitch measurement.
Definition: fsw_attitude_determination_multi_sensor.h:47
CD_REQUEST_REF unit_vector_ref
Star catalog unit vectors.
Definition: fsw_attitude_determination_multi_sensor.h:39
CD_CREATE_REF ad_sun_meas_noise_covariance_command_ref
Sun sensor measurement noise.
Definition: fsw_attitude_determination_multi_sensor.h:125
CD_CREATE_REF ad_gyro_bias_camera_ref
Gyro bias estimated.
Definition: fsw_attitude_determination_multi_sensor.h:77
CD_REQUEST_REF ephem_sun_vector_ref
Sun vector.
Definition: fsw_attitude_determination_multi_sensor.h:55
CD_CREATE_REF ad_b_field_meas_noise_covariance_command_ref
B field measurement noise.
Definition: fsw_attitude_determination_multi_sensor.h:123
CD_REQUEST_REF sun_sensor_valid_ref
Sun sensor data validity flag.
Definition: fsw_attitude_determination_multi_sensor.h:53
CD_CREATE_REF ad_q_body_to_star_sensor_ref
Quaternion from body to the sun sensor.
Definition: fsw_attitude_determination_multi_sensor.h:95
CD_CREATE_REF ad_q_eci_to_camera_single_frame_ref
Single frame ad camera.
Definition: fsw_attitude_determination_multi_sensor.h:81
CD_CREATE_REF ad_planet_data_ref
Q ECI to Body from the simulation.
Definition: fsw_attitude_determination_multi_sensor.h:73
CD_CREATE_REF ad_plant_noise_covariance_command_ref
UKF plant noise covariance.
Definition: fsw_attitude_determination_multi_sensor.h:107
CD_REQUEST_REF magnetometer_ref
Magnetometer measurements.
Definition: fsw_attitude_determination_multi_sensor.h:51
CD_CREATE_REF ad_meas_magnetometer_noise_covariance_command_ref
UKF measurement noise covariance.
Definition: fsw_attitude_determination_multi_sensor.h:113
CD_CREATE_REF ad_q_eci_to_camera_ref
Single frame ad camera.
Definition: fsw_attitude_determination_multi_sensor.h:83
CD_CREATE_REF ad_use_single_frame_command_ref
Use single frame camera solutions.
Definition: fsw_attitude_determination_multi_sensor.h:97
void initialize_data()
Create data and request the FSW_ATTITUDE_DETERMINATION_TRIGGER.
Definition: fsw_attitude_determination_multi_sensor.cc:19
CD_CREATE_REF ad_meas_star_noise_covariance_command_ref
UKF measurement noise covariance.
Definition: fsw_attitude_determination_multi_sensor.h:109
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.