WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
IMU.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX INC 2025. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX INC. 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 INC.
15******************************************************************************/
16/*
17IMU model header file
18
19Author: Alex Reynolds
20*/
21/*
22Metadata for MS GUI:
23imdata = {"displayname" : "IMU",
24 "exclude" : False,
25 "category" : "Sensors"
26}
27aliases = {"accelerometer_bias_initial" : "Accelerometer Bias",
28 "min_acceleration" : "Minimum Acceleration",
29 "max_acceleration" : "Maximum Acceleration",
30 "gyroscope_bias_initial" : "Gyro Bias",
31 "min_ang_vel" : "Minimum Angular Velocity",
32 "max_ang_vel" : "Maximum Angluar Velocity",
33 "mount_frame" : "Spacecraft Body",
34 "mount_position__mf" : "Body Mount Position",
35 "mount_alignment_mf" : "Body Mount Alignment",
36 "rate_hz" : "Rate Hz",
37 "accelerometer_seed_value" : "EXCLUDE",
38 "gyro_seed_value" : "EXCLUDE",
39 "gravity_frame" : "Gravity Vector Frame",
40 "accelerometer_resolution" : "EXCLUDE",
41 "gyroscope_resolution" : "EXCLUDE",
42 "latency" : "EXCLUDE",
43 "accelerometer_gaussian_noise" : "Accelerometer Noise",
44 "accelerometer_walking_bias_std" : "EXCLUDE",
45 "accelerometer_scale_factor_std" : "EXCLUDE",
46 "gyroscope_gaussian_noise" : "Gyro Noise",
47 "gyroscope_walking_bias_std" : "EXCLUDE",
48 "gyroscope_scale_factor_std" : "EXCLUDE",
49 "gravity__gf" : "Gravity Vector",
50 "meas_accel_sf" : "Meas. Acceleration",
51 "perfect_accel_sf" : "EXCLUDE",
52 "meas_accel_sf_incl_grav" : "EXCLUDE",
53 "perfect_accel_sf_incl_grav" : "EXCLUDE",
54 "meas_ang_vel_sf" : "Meas. Ang. Vel.",
55 "perfect_ang_vel_sf" : "EXCLUDE",
56 "accelerometer_is_valid" : "Accelerometer Meas. Validity Flag",
57 "gyroscope_is_valid" : "Gyro Meas. Validity Flag",
58 "accelerometer_operational_power_draw" : "Accelerometer Operational Power Draw",
59 "gyro_operational_power_draw" : "Gyro Operational Power Draw",
60 "mass" : "Mass",
61 "accelerometer_current_power_draw" : "Accelerometer Current Power Draw",
62 "gyro_current_power_draw" : "Gyro Current Power Draw",
63}
64*/
65
66#ifndef MODELS_SENSORS_IMU_H
67#define MODELS_SENSORS_IMU_H
68
69#include "simulation/Model.h"
73
74namespace warptwin {
75
85 MODEL(IMU)
86 public:
87 // Model params
88 // NAME TYPE DEFAULT VALUE
92 SIGNAL(accelerometer_bias_initial, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
94 SIGNAL(min_acceleration, double, -20.0*warpos::earth_wgs84.mean_gravity)
96 SIGNAL(max_acceleration, double, 20.0*warpos::earth_wgs84.mean_gravity)
99 SIGNAL(gyroscope_bias_initial, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
101 SIGNAL(min_ang_vel, double, -540.0*warpos::DEGREES_TO_RADIANS)
103 SIGNAL(max_ang_vel, double, 540.0*warpos::DEGREES_TO_RADIANS)
107 SIGNAL(mount_frame, Frame*, nullptr)
110 SIGNAL(mount_position__mf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
112 SIGNAL(mount_alignment_mf, clockwerk::Quaternion, clockwerk::Quaternion({1.0, 0.0, 0.0, 0.0}))
115 SIGNAL(rate_hz, int, 0)
117 SIGNAL(accelerometer_seed_value,int, 0)
119 SIGNAL(gyro_seed_value, int, 0)
122 SIGNAL(gravity_frame, Frame*, nullptr)
126 SIGNAL(accelerometer_resolution, double, 0.0)
130 SIGNAL(gyroscope_resolution, double, 0.0)
134 SIGNAL(latency, int, 0)
137 SIGNAL(accelerometer_operational_power_draw, double, 0.0)
140 SIGNAL(gyro_operational_power_draw, double, 0.0)
142 SIGNAL(mass, double, 0.0)
144
145 // Model inputs
146 // NAME TYPE DEFAULT VALUE
150 SIGNAL(accelerometer_gaussian_noise, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
153 SIGNAL(accelerometer_walking_bias_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
155 SIGNAL(accelerometer_scale_factor_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
158 SIGNAL(gyroscope_gaussian_noise, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
161 SIGNAL(gyroscope_walking_bias_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
163 SIGNAL(gyroscope_scale_factor_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
165 SIGNAL(gravity__gf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
167
168 // Model outputs
169 // NAME TYPE DEFAULT VALUE
174 SIGNAL(output_time, clockwerk::Time, clockwerk::Time(0, 0))
178 SIGNAL(meas_accel_sf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
182 SIGNAL(perfect_accel_sf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
186 SIGNAL(meas_accel_sf_incl_grav, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
190 SIGNAL(perfect_accel_sf_incl_grav, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
194 SIGNAL(meas_ang_vel_sf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
198 SIGNAL(perfect_ang_vel_sf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
201 SIGNAL(accelerometer_is_valid, bool, false)
204 SIGNAL(gyroscope_is_valid, bool, false)
207 SIGNAL(accelerometer_current_power_draw, double, 0.0)
210 SIGNAL(gyro_current_power_draw, double, 0.0)
212 SIGNAL(gyro_bias, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
214 SIGNAL(accel_bias, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
216
219 warptwin::Accelerometer* accelerometer() {return &_accelerometer;}
220
224
225 // Activate amd deactivate functions call both the accelerometer and gyro active/deactive
226 int16 activate() override;
227 int16 deactivate() override;
228
229 // Model-specific implementations of startup and derivative
230 protected:
231 int16 start() override;
232
234 void _configureInternal();
235
237 warptwin::Accelerometer _accelerometer;
238
241 };
242
243}
244
245#endif
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition appmacros.h:27
#define START_PARAMS
Definition appmacros.h:42
#define END_OUTPUTS
Definition appmacros.h:33
#define END_PARAMS
Definition appmacros.h:47
#define START_OUTPUTS
Definition appmacros.h:28
#define END_INPUTS
Definition appmacros.h:40
#define START_INPUTS
Definition appmacros.h:35
Frame class definition.
Definition Frame.h:96
#define CartesianVector3
Definition mathmacros.h:43
PlanetDefaults earth_wgs84
Definition planetdefaults.cpp:22
const floating_point DEGREES_TO_RADIANS
Definition unitutils.h:47
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
int16 start() override
Class to execute logging.
warptwin::Gyroscope * Gyroscope()
Function to access the internal gyro model.
Definition IMU.h:223
SIGNAL(_mu, double, warpos::earth_wgs84.mu)
warptwin::Accelerometer _accelerometer
The IMU accelerometer model.
Definition IMU.h:237
warptwin::Gyroscope _gyro
The IMU gyro model.
Definition IMU.h:240
void _configureInternal()
Function to configure sensor – runs in all constructors.
int16 activate() override
MODEL(Servo) public int16 deactivate() override
Model to simulate a servo's motion.
@ MODEL
Simplified dynamics model representing motion in the circular restricted 3 body problem.
Definition ImNode.h:31