ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
IMU.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/*
17IMU model header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef MODELS_SENSORS_IMU_H
23#define MODELS_SENSORS_IMU_H
24
25#include "core/macros.h"
26#include "simulation/Model.h"
27#include "models/sensors/Accelerometer.h"
28#include "models/sensors/Gyro.h"
29
30namespace modelspace {
31
32 /**
33 * @brief IMU Model
34 *
35 * The IMU model is a simple wrapper around the accelerometer and gyro models,
36 * wrapping them into a single package. For details on each element of the IMU,
37 * see the accelerometer or gyro definitions.
38 *
39 * Author: Alex Reynolds <alex.reynolds@attx.tech>
40 */
41 class IMU : public Model {
42 public:
43 // Model params
44 // NAME TYPE DEFAULT VALUE
46 /** The bias in accelerometer measurement output described as a three-element vector in the same units
47 * as the output. Default is no bias. */
49 /** The one-sigma gaussian noise in accelerometer measurement output described as a three-element vector
50 * in the same units as the output. Default is no noise. */
52 /** The bias in gyro measurement output described as a three-element vector in the same units
53 * as the output. Default is no bias. */
55 /** The one-sigma gaussian noise in gyro measurement output described as a three-element vector
56 * in the same units as the output. Default is no noise. */
58 /** The vehicle frame relative to which the sensor 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 sensor in the mount frame, represented in the default simulation
63 * unit (meters by default. pretty much always meters) */
65 /** The alignment of the accelerometer relative to the mount frame */
66 SIGNAL(mount_alignment_mf, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
67 /** The rate at which the sensor generates an output, in hertz. Setting this value
68 * to 0 forces the sensor to output at the simulation rate. */
69 SIGNAL(rate_hz, int, 0)
70 /** Value to seed the internal RNG for this model. */
72 /** Value to seed the internal RNG for this model. */
73 SIGNAL(gyro_seed_value, int, 0)
74 /** The frame in which gravity is represented. If this parameter is not set,
75 * the gravity frame is assumed to be the root frame of the simulation. */
78
79 // Model inputs
80 // NAME TYPE DEFAULT VALUE
82 /** The gravity vector acting on the sensor as represented in the gravity frame */
85
86 // Model outputs
87 // NAME TYPE DEFAULT VALUE
89 /** The measured output acceleration produced by the accelerometer describing the
90 * acceleration of the sensor frame relative to the simulation root frame
91 * appropriate bias, noise, and rate limiting, with gravity removed */
93 /** The "perfect" output acceleration produced by the accelerometer describing the
94 * acceleration of the sensor frame relative to the simulation root frame
95 * without error sources, with gravity removed. This is an informational parameter. */
97 /** The "perfect" output acceleration produced by the accelerometer describing the
98 * acceleration of the sensor frame relative to the simulation root frame
99 * without error sources, with gravity included. This is an informational parameter */
101 /** The measured output angular velocity produced by the gyro describing the
102 * angular velocity of the sensor frame relative to the simulation root frame
103 * appropriate bias, noise, and rate limiting */
105 /** The "perfect" output angular velocity produced by the gyro describing the
106 * angular velocity of the sensor frame (incl. misalignment) relative to the simulation root frame
107 * without bias and noise. This is an informational parameter. */
110
111 /// @brief Function to access the internal accelerometer model
112 /// @return Handle to the accelerometer model
114
115 /// @brief Function to access the internal gyro model
116 /// @return Handle to the gyro model
117 modelspace::Gyro* gyro() {return &_gyro;}
118
119 // Model-specific implementations of startup and derivative
120 IMU(Model &pnt, const std::string &m_name="imu");
121 IMU(SimulationExecutive &e, const std::string &m_name="imu");
122 IMU(Model &pnt, int schedule_slot, const std::string &m_name="imu");
123 IMU(SimulationExecutive &e, int schedule_slot, const std::string &m_name="imu");
124 virtual ~IMU() {}
125 protected:
126 int start();
127
128 /// @brief Function to configure sensor -- runs in all constructors
129 void _configureInternal();
130
131 /// @brief The IMU accelerometer model
133
134 /// @brief The IMU gyro model
135 Gyro _gyro;
136 };
137
138}
139
140#endif
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
Gyro Model.
Definition Gyro.h:43
IMU Model.
Definition IMU.h:41
Gyro _gyro
The IMU gyro model.
Definition IMU.h:135
modelspace::Gyro * gyro()
Function to access the internal gyro model.
Definition IMU.h:117
void _configureInternal()
Function to configure sensor – runs in all constructors.
Definition IMU.cpp:49
modelspace::Accelerometer * accelerometer()
Function to access the internal accelerometer model.
Definition IMU.h:113
Accelerometer _accelerometer
The IMU accelerometer model.
Definition IMU.h:132
int start()
Function to perform task startup activities (step once after creation)
Definition IMU.cpp:76
Base model class for derived implementation.
Definition Model.h:56
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 > > gravity__gf
Definition IMU.h:83
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > perfect_accel_sf_incl_grav
Definition IMU.h:100
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > perfect_accel_sf
Definition IMU.h:96
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > meas_accel_sf
Definition IMU.h:92
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > perfect_ang_vel_sf
Definition IMU.h:108
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > meas_ang_vel_sf
Definition IMU.h:104
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > gyro_bias
Definition IMU.h:54
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > mount_position__mf
Definition IMU.h:64
clockwerk::DataIO< clockwerk::Frame< double > * > gravity_frame
Definition IMU.h:76
clockwerk::DataIO< clockwerk::Frame< double > * > mount_frame
Definition IMU.h:61
clockwerk::DataIO< int > gyro_seed_value
Definition IMU.h:73
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > accelerometer_gaussian_noise
Definition IMU.h:51
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > gyro_gaussian_noise
Definition IMU.h:57
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > accelerometer_bias
Definition IMU.h:48
clockwerk::DataIO< int > rate_hz
Definition IMU.h:69
clockwerk::DataIO< int > accelerometer_seed_value
Definition IMU.h:71
clockwerk::DataIO< clockwerk::Quaternion< double > > mount_alignment_mf
Definition IMU.h:66