WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
Gyroscope.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/*
17Gyro model header file
18
19Author: Alex Reynolds
20*/
21/*
22Metadata for MS GUI:
23imdata = {"displayname" : "Gyro",
24 "exclude" : False,
25 "category" : "Sensors"
26}
27aliases = {"bias_initial" : "Bias",
28 "min_ang_vel" : "Minimum Ang. Vel.",
29 "max_ang_vel" : "Maximum Ang. Vel.",
30 "mount_frame" : "Spacecraft Body",
31 "mount_position__mf" : "Body Mount Position",
32 "mount_alignment_mf" : "Body Mount Alignment",
33 "resolution" : "EXCLUDE",
34 "rate_hz" : "Rate Hz",
35 "seed_value" : "EXCLUDE",
36 "latency" : "EXCLUDE",
37 "gaussian_noise" : "Noise",
38 "walking_bias_std" : "EXCLUDE",
39 "scale_factor_std" : "EXCLUDE",
40 "meas_ang_vel_sf" : "Meas. Ang. Vel.",
41 "perfect_ang_vel_sf" : "EXCLUDE",
42 "is_valid" : "Meas. Validity Flag",
43 "operational_power_draw" : "Operational Power Draw",
44 "mass" : "Mass",
45 "current_power_draw" : "Current Power Draw",
46}
47*/
48
49#ifndef MODELS_SENSORS_GYROSCOPE_H
50#define MODELS_SENSORS_GYROSCOPE_H
51
52#include "simulation/Model.h"
53#include "constants/unitutils.h"
56#include "utils/LatencyUtil.hpp"
57
58namespace warptwin {
59
94
100 // Default constuctor (should populate with model defualt outputs)
102 : meas_ang_vel_sf(CartesianVector3({0.0, 0.0, 0.0})),
103 bias(CartesianVector3({0.0, 0.0, 0.0})),
104 is_valid(false) {}
105 // Custom constructor
110 };
111
113 public:
114 // Model params
115 // NAME TYPE DEFAULT VALUE
119 SIGNAL(bias_initial, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
121 SIGNAL(min_ang_vel, double, -540.0*warpos::DEGREES_TO_RADIANS)
123 SIGNAL(max_ang_vel, double, 540.0*warpos::DEGREES_TO_RADIANS)
127 SIGNAL(mount_frame, Frame*, nullptr)
130 SIGNAL(mount_position__mf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
132 SIGNAL(mount_alignment_mf, clockwerk::Quaternion, clockwerk::Quaternion({1.0, 0.0, 0.0, 0.0}))
136 SIGNAL(resolution, double, 0.0)
139 SIGNAL(rate_hz, int, 0)
141 SIGNAL(seed_value, int, 0)
145 SIGNAL(latency, int, 0)
148 SIGNAL(operational_power_draw, double, 0.0)
150 SIGNAL(mass, double, 0.0)
152
153 // Model inputs
154 // NAME TYPE DEFAULT VALUE
158 SIGNAL(gaussian_noise, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
161 SIGNAL(walking_bias_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
163 SIGNAL(scale_factor_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
165
166 // Model outputs
167 // NAME TYPE DEFAULT VALUE
172 SIGNAL(output_time, clockwerk::Time, clockwerk::Time(0, 0))
176 SIGNAL(meas_ang_vel_sf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
181 SIGNAL(perfect_ang_vel_sf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
184 SIGNAL(is_valid, bool, false)
187 SIGNAL(current_power_draw, double, 0.0)
189 SIGNAL(bias, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
191
193 clockwerk::DataIO<Frame*> sensor_frame = clockwerk::DataIO<Frame*>(this, "sensor_frame", &_sensor_frame);
194
197 warptwin::MarkovUncertaintyModel* getNoiseModel() {return &_sensor_noise_model;}
198
201 warptwin::RateMonitor* rateMonitor() {return &_rate_monitor;}
202
203 int16 activate() override;
204 int16 deactivate() override;
205
206 protected:
207 int16 start() override;
208 int16 execute() override;
209
211 void _configureInternal();
212
215
217 MarkovUncertaintyModel _sensor_noise_model;
218
220 RateMonitor _rate_monitor;
221
224
227
230
232 std::array<bool, 3> _in_deadzone;
233
236
239 };
240
241}
242
243#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
Latency model.
Definition LatencyUtil.hpp:41
#define CartesianVector3
Definition mathmacros.h:43
const floating_point DEGREES_TO_RADIANS
Definition unitutils.h:47
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
CartesianVector3 _previous_bias
Temporary variable to hold the bias vector at last function call.
Definition Accelerometer.h:246
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)
MarkovUncertaintyModel _sensor_noise_model
The bias and noise model for sensor output.
Definition Accelerometer.h:240
Frame _sensor_frame
The sensor frame in which all measurements will be taken.
Definition Accelerometer.h:237
void _configureInternal()
Function to configure sensor – runs in all constructors.
warptwin::RateMonitor * rateMonitor()
Accessor for the internal rate monitor model.
Definition Accelerometer.h:224
int16 activate() override
_accel_output_struct _last_output
Temporary variable for the latest recorded output added to latency model and dummy output for steppin...
Definition Accelerometer.h:264
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
LatencyUtil< double > _latency_model
The latency model for servo angle output.
Definition Servo.h:116
CartesianVector3 _total_error
Temporary variable to hold total error for gyro.
Definition Gyroscope.h:223
MODEL(Accelerometer) public warptwin::MarkovUncertaintyModel * getNoiseModel()
Accessor for the internal noise model.
Definition Accelerometer.h:220
CartesianVector3 _perturbed_ang_vel
Temporary variable to hold the perturbed ang vel.
Definition Gyroscope.h:229
int16 execute() override
Function to check monitor input conditions and set trigger flag accordingly. Should be implemented in...
RateMonitor _rate_monitor
Rate monitor to control the rate at which the sensor runs.
Definition Accelerometer.h:243
clockwerk::CartesianVector< 3 > _in_deadzone
Temporary variable for checking if sensor is in deadzone. Each element of vector corresponds to an ax...
Definition Accelerometer.h:258
double _latency_return
Temporary value for the return of the latency value.
Definition Servo.h:122
Gyro Model.
Definition Gyroscope.h:96
bool is_valid
Definition Gyroscope.h:99
CartesianVector3 meas_ang_vel_sf
Definition Gyroscope.h:97
_gyro_output_struct(CartesianVector3 meas_ang_vel_sf, CartesianVector3 bias, bool is_valid)
Definition Gyroscope.h:106
CartesianVector3 bias
Definition Gyroscope.h:98
_gyro_output_struct()
Definition Gyroscope.h:101