ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
Accelerometer.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/*
17Accelerometer model header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef MODELS_SENSORS_ACCELEROMETER_H
23#define MODELS_SENSORS_ACCELEROMETER_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 Accelerometer Model
38 *
39 *
40 *
41 * Author: Alex Reynolds <alex.reynolds@attx.tech>
42 */
43 class Accelerometer : 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)
68 /** The frame in which gravity is represented. If this parameter is not set,
69 * the gravity frame is assumed to be the root frame of the simulation. */
72
73 // Model inputs
74 // NAME TYPE DEFAULT VALUE
76 /** The gravity vector acting on the sensor as represented in the gravity frame */
79
80 // Model outputs
81 // NAME TYPE DEFAULT VALUE
83 /** The measured output acceleration produced by the accelerometer describing the
84 * acceleration of the sensor frame relative to the simulation root frame
85 * appropriate bias, noise, and rate limiting, with gravity removed */
87 /** The "perfect" output acceleration produced by the accelerometer describing the
88 * acceleration of the sensor frame relative to the simulation root frame
89 * without error sources, with gravity removed. This is an informational parameter. */
91 /** The "perfect" output acceleration produced by the accelerometer describing the
92 * acceleration of the sensor frame relative to the simulation root frame
93 * without error sources, with gravity included. This is an informational parameter */
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 Accelerometer(Model &pnt, const std::string &m_name="accelerometer");
110 Accelerometer(SimulationExecutive &e, const std::string &m_name="accelerometer");
111 Accelerometer(Model &pnt, int schedule_slot, const std::string &m_name="accelerometer");
112 Accelerometer(SimulationExecutive &e, int schedule_slot, const std::string &m_name="accelerometer");
113 virtual ~Accelerometer() {}
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 /// @brief Temporary variable to hold total error for gyro
132
133 /// @brief A DCM relating our sensor frame to root
135
136 /// @brief The gravity vector as represented in the sensor frame
138 };
139
140}
141
142#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
Accelerometer Model.
Definition Accelerometer.h:43
clockwerk::DataIO< clockwerk::Frame< double > * > sensor_frame
Accessor for the sensor's frame.
Definition Accelerometer.h:98
modelspace::RateMonitor * rateMonitor()
Accessor for the internal rate monitor model.
Definition Accelerometer.h:106
int start()
Function to perform task startup activities (step once after creation)
Definition Accelerometer.cpp:69
int execute()
Function to execute the task. All math and calculations should be here.
Definition Accelerometer.cpp:102
clockwerk::CartesianVector< double, 3 > _gravity__sensor
The gravity vector as represented in the sensor frame.
Definition Accelerometer.h:137
clockwerk::CartesianVector< double, 3 > _total_error
Temporary variable to hold total error for gyro.
Definition Accelerometer.h:131
clockwerk::DCM< double > _dcm_sf_root
A DCM relating our sensor frame to root.
Definition Accelerometer.h:134
modelspace::BiasNoiseModel * biasNoiseModel()
Accessor for the internal bias and noise model.
Definition Accelerometer.h:102
BiasNoiseModel _sensor_bias_noise
The bias and noise model for sensor output.
Definition Accelerometer.h:125
RateMonitor _rate_monitor
Rate monitor to control the rate at which the sensor runs.
Definition Accelerometer.h:128
void _configureInternal()
Function to configure sensor – runs in all constructors.
Definition Accelerometer.cpp:55
clockwerk::Frame< double > _sensor_frame
The sensor frame in which all measurements will be taken.
Definition Accelerometer.h:122
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
#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 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 > > gravity__gf
Definition Accelerometer.h:77
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > perfect_accel_sf
Definition Accelerometer.h:90
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > perfect_accel_sf_incl_grav
Definition Accelerometer.h:94
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > meas_accel_sf
Definition Accelerometer.h:86
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > bias
Definition Accelerometer.h:50
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > mount_position__mf
Definition Accelerometer.h:60
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > gaussian_noise
Definition Accelerometer.h:53
clockwerk::DataIO< clockwerk::Frame< double > * > mount_frame
Definition Accelerometer.h:57
clockwerk::DataIO< int > seed_value
Definition Accelerometer.h:67
clockwerk::DataIO< clockwerk::Frame< double > * > gravity_frame
Definition Accelerometer.h:70
clockwerk::DataIO< clockwerk::Quaternion< double > > mount_alignment_mf
Definition Accelerometer.h:62
clockwerk::DataIO< int > rate_hz
Definition Accelerometer.h:65