ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
Gyro.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/*
17Gyro model header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef MODELS_SENSORS_GYRO_H
23#define MODELS_SENSORS_GYRO_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 Gyro Model
38 *
39 *
40 *
41 * Author: Alex Reynolds <alex.reynolds@attx.tech>
42 */
43 class Gyro : public Model {
44 public:
45 // Model params
46 // NAME TYPE DEFAULT VALUE
48 /** The bias in measurement output described as a three-element vector in the same units
49 * as the output. Default is no bias. */
51 /** The one-sigma gaussian noise in measurement output described as a three-element vector
52 * in the same units as the output. Default is no noise. */
54 /** The vehicle frame relative to which the sensor is mounted and aligned. This is most
55 * typically the body frame of a spacecraft or other vehicle. mount_position__mf and mount_alignment__mf
56 * are described relative to this frame. */
57 SIGNAL(mount_frame, FrameD*, nullptr)
58 /** The position of the sensor in the mount frame, represented in the default simulation
59 * unit (meters by default. pretty much always meters) */
61 /** The alignment of the accelerometer relative to the mount frame */
62 SIGNAL(mount_alignment_mf, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
63 /** The rate at which the sensor generates an output, in hertz. Setting this value
64 * to 0 forces the sensor to output at the simulation rate. */
65 SIGNAL(rate_hz, int, 0)
66 /** Value to seed the internal RNG for this model. */
67 SIGNAL(seed_value, int, 0)
69
70 // Model inputs
71 // NAME TYPE DEFAULT VALUE
73
75
76 // Model outputs
77 // NAME TYPE DEFAULT VALUE
79 /** The measured output angular velocity produced by the gyro describing the
80 * angular velocity of the sensor frame relative to the simulation root frame
81 * appropriate bias, noise, and rate limiting */
83 /** The "perfect" output angular velocity produced by the gyro describing the
84 * angular velocity of the sensor frame (incl. misalignment) relative to the simulation root frame
85 * without bias and noise. This is an informational parameter. */
88
89 /// @brief Accessor for the sensor's frame
90 clockwerk::DataIO<FrameD*> sensor_frame = clockwerk::DataIO<FrameD*>(this, "sensor_frame", &_sensor_frame);
91
92 /// @brief Accessor for the internal bias and noise model
93 /// @return Pointer to the bias noise model
95
96 /// @brief Accessor for the internal rate monitor model
97 /// @return Pointer to the rate monitor model
99
100 // Model-specific implementations of startup and derivative
101 Gyro(Model &pnt, const std::string &m_name="gyro");
102 Gyro(SimulationExecutive &e, const std::string &m_name="gyro");
103 Gyro(Model &pnt, int schedule_slot, const std::string &m_name="gyro");
104 Gyro(SimulationExecutive &e, int schedule_slot, const std::string &m_name="gyro");
105 virtual ~Gyro() {}
106 protected:
107 int start();
108 int execute();
109
110 /// @brief Function to configure sensor -- runs in all constructors
111 void _configureInternal();
112
113 /// @brief The sensor frame in which all measurements will be taken
115
116 /// @brief The bias and noise model for sensor output.
118
119 /// @brief Rate monitor to control the rate at which the sensor runs
121
122 /// @brief Temporary variable to hold total error for gyro
124 };
125
126}
127
128#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
Gyro Model.
Definition Gyro.h:43
modelspace::BiasNoiseModel * biasNoiseModel()
Accessor for the internal bias and noise model.
Definition Gyro.h:94
modelspace::RateMonitor * rateMonitor()
Accessor for the internal rate monitor model.
Definition Gyro.h:98
clockwerk::Frame< double > _sensor_frame
The sensor frame in which all measurements will be taken.
Definition Gyro.h:114
BiasNoiseModel _sensor_bias_noise
The bias and noise model for sensor output.
Definition Gyro.h:117
void _configureInternal()
Function to configure sensor – runs in all constructors.
Definition Gyro.cpp:54
RateMonitor _rate_monitor
Rate monitor to control the rate at which the sensor runs.
Definition Gyro.h:120
clockwerk::DataIO< clockwerk::Frame< double > * > sensor_frame
Accessor for the sensor's frame.
Definition Gyro.h:90
int start()
Function to perform task startup activities (step once after creation)
Definition Gyro.cpp:68
clockwerk::CartesianVector< double, 3 > _total_error
Temporary variable to hold total error for gyro.
Definition Gyro.h:123
int execute()
Function to execute the task. All math and calculations should be here.
Definition Gyro.cpp:91
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
#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 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::CartesianVector< double, 3 > > meas_ang_vel_sf
Definition Gyro.h:82
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > perfect_ang_vel_sf
Definition Gyro.h:86
clockwerk::DataIO< clockwerk::Quaternion< double > > mount_alignment_mf
Definition Gyro.h:62
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > mount_position__mf
Definition Gyro.h:60
clockwerk::DataIO< int > rate_hz
Definition Gyro.h:65
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > bias
Definition Gyro.h:50
clockwerk::DataIO< int > seed_value
Definition Gyro.h:67
clockwerk::DataIO< clockwerk::Frame< double > * > mount_frame
Definition Gyro.h:57
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > gaussian_noise
Definition Gyro.h:53