ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
StarTracker.h
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, LLC.
15******************************************************************************/
16/*
17Star Tracker model header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef MODELS_SENSORS_STAR_TRACKER_H
23#define MODELS_SENSORS_STAR_TRACKER_H
24
25#include "core/macros.h"
26#include "simulation/Model.h"
27#include "six_dof_dynamics/Euler321.hpp"
28#include "six_dof_dynamics/Quaternion.hpp"
29#include "six_dof_dynamics/DCM.hpp"
30#include "six_dof_dynamics/Frame.hpp"
31#include "models/support/BiasNoiseModel.h"
32#include "monitors/RateMonitor.h"
33
34namespace modelspace {
35
36 /**
37 * @brief Star Tracker Model
38 *
39 * This model represents a simple star tracker which may be parameterized
40 * with a given bias, noise, and rate. It measures the attitude of the
41 * star tracker frame, which is internally configured, relative to
42 * an externally assigned reference frame.
43 *
44 * Author: Alex Reynolds <alex.reynolds@attx.tech>
45 */
46 class StarTracker : public Model {
47 public:
48 // Model params
49 // NAME TYPE DEFAULT VALUE
51 /** The bias in measurement output described as a 3-2-1 Euler angle sequence, with angles
52 * in RADIANS. This parameter may account for a number of factors, including misalignment,
53 * measurement bias, etc. Default is no bias. */
54 SIGNAL(bias, Euler321D, Euler321D({0.0, 0.0, 0.0}))
55 /** The one-sigma gaussian noise in measurement output described as a 3-2-1 Euler angle sequence,
56 * with angles in RADIANS. Default is no noise. */
57 SIGNAL(gaussian_noise, Euler321D, Euler321D({0.0, 0.0, 0.0}))
58 /** The vehicle frame relative to which the star tracker is mounted and aligned. This is most
59 * typically the body frame of a spacecraft or other vehicle. mount_position__mf and mount_alignment__mf
60 * are described relative to this frame. */
61 SIGNAL(mount_frame, FrameD*, nullptr)
62 /** The position of the star tracker in the mount frame, represented in the default simulation
63 * unit (meters by default. pretty much always meters) */
65 /** The alignment of the star tracker relative to the mount frame */
66 SIGNAL(mount_alignment_mf, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
67 /** The reference frame relative to which all star tracker measurements will be returned.
68 * If a reference frame is not set, all star tracker measurements will be returned relative
69 * to the simulation root frame. */
71 /** The rate at which the star tracker generates an output, in hertz. Setting this value
72 * to 0 forces the star tracker to output at the simulation rate. */
73 SIGNAL(rate_hz, int, 0)
74 /** Value to seed the internal RNG for this model. */
75 SIGNAL(seed_value, int, 0)
77
78 // Model inputs
79 // NAME TYPE DEFAULT VALUE
81
83
84 // Model outputs
85 // NAME TYPE DEFAULT VALUE
87 /** The measurement output quaternion produced by the star tracker describing the
88 * orientation of the star tracker "sensor frame" relative to the reference frame plus
89 * appropriate bias, noise, and rate limiting. */
90 SIGNAL(meas_quat_sf_ref, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
91 /** The "perfect" output quaternion produced by the star tracker describing the
92 * orientation of the star tracker "sensor frame" relative to the reference frame. This parameter
93 * is informational and free from error. */
94 SIGNAL(perfect_quat_sf_ref, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
96
97 /// @brief Accessor for the sensor's frame
98 clockwerk::DataIO<FrameD*> sensor_frame = clockwerk::DataIO<FrameD*>(this, "sensor_frame", &_sensor_frame);
99
100 /// @brief Accessor for the internal bias and noise model
101 /// @return Pointer to the bias noise model
103
104 /// @brief Accessor for the internal rate monitor model
105 /// @return Pointer to the rate monitor model
107
108 // Model-specific implementations of startup and derivative
109 StarTracker(Model &pnt, const std::string &m_name="star_tracker");
110 StarTracker(SimulationExecutive &e, const std::string &m_name="star_tracker");
111 StarTracker(Model &pnt, int schedule_slot, const std::string &m_name="star_tracker");
112 StarTracker(SimulationExecutive &e, int schedule_slot, const std::string &m_name="star_tracker");
113 virtual ~StarTracker() {}
114 protected:
115 int start();
116 int execute();
117
118 /// @brief Function to configure sensor -- runs in all constructors
119 void _configureInternal();
120
121 /// @brief The sensor frame in which all measurements will be taken
123
124 /// @brief The bias and noise model for sensor output.
126
127 /// @brief Rate monitor to control the rate at which the sensor runs
129
130 // Temporary DCM to hold temporary attitude calculations
131 DCMD _tmp_dcm;
132
133 // Internal variable to hold full bias and noise
134 Euler321D _total_error;
135 };
136
137}
138
139#endif
Class for inter-object communication.
Definition DataIO.hpp:46
DataIO(GraphTreeObject *data_parent, std::string data_name, T initial_value)
Constructor for the DataIO object.
Definition DataIO.hpp:134
Bias and noise model.
Definition BiasNoiseModel.h:39
Base model class for derived implementation.
Definition Model.h:56
Monitor to trigger at a particular rate.
Definition RateMonitor.h:42
Implementation of the executive class for simulation.
Definition SimulationExecutive.h:63
Star Tracker Model.
Definition StarTracker.h:46
clockwerk::DataIO< clockwerk::Frame< double > * > sensor_frame
Accessor for the sensor's frame.
Definition StarTracker.h:98
RateMonitor _rate_monitor
Rate monitor to control the rate at which the sensor runs.
Definition StarTracker.h:128
modelspace::RateMonitor * rateMonitor()
Accessor for the internal rate monitor model.
Definition StarTracker.h:106
int start()
Function to perform task startup activities (step once after creation)
Definition StarTracker.cpp:67
modelspace::BiasNoiseModel * biasNoiseModel()
Accessor for the internal bias and noise model.
Definition StarTracker.h:102
clockwerk::Frame< double > _sensor_frame
The sensor frame in which all measurements will be taken.
Definition StarTracker.h:122
BiasNoiseModel _sensor_bias_noise
The bias and noise model for sensor output.
Definition StarTracker.h:125
int execute()
Function to execute the task. All math and calculations should be here.
Definition StarTracker.cpp:101
void _configureInternal()
Function to configure sensor – runs in all constructors.
Definition StarTracker.cpp:53
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition macros.h:87
#define START_PARAMS
Definition macros.h:96
#define CartesianVector3D
Definition macros.h:54
#define END_OUTPUTS
Definition macros.h:90
#define END_PARAMS
Definition macros.h:98
#define DCMD
Definition macros.h:70
#define Euler321D
Definition macros.h:72
#define QuaternionD
Definition macros.h:78
#define START_OUTPUTS
Definition macros.h:88
#define FrameD
Definition macros.h:64
#define END_INPUTS
Definition macros.h:94
#define START_INPUTS
Definition macros.h:92
Class to propagate CR3BP dynamics in characteristic units.
Definition ConfigurationWriter.cpp:18
clockwerk::DataIO< clockwerk::Quaternion< double > > perfect_quat_sf_ref
Definition StarTracker.h:94
clockwerk::DataIO< clockwerk::Quaternion< double > > meas_quat_sf_ref
Definition StarTracker.h:90
clockwerk::DataIO< clockwerk::Frame< double > * > reference_frame
Definition StarTracker.h:70
clockwerk::DataIO< clockwerk::Euler321< double > > gaussian_noise
Definition StarTracker.h:57
clockwerk::DataIO< clockwerk::Euler321< double > > bias
Definition StarTracker.h:54
clockwerk::DataIO< int > rate_hz
Definition StarTracker.h:73
clockwerk::DataIO< int > seed_value
Definition StarTracker.h:75
clockwerk::DataIO< clockwerk::Quaternion< double > > mount_alignment_mf
Definition StarTracker.h:66
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > mount_position__mf
Definition StarTracker.h:64
clockwerk::DataIO< clockwerk::Frame< double > * > mount_frame
Definition StarTracker.h:61