WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
GPS.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/*
17GPS model header file
18
19Author: James Tabony
20*/
21/*
22Metadata for MS GUI:
23imdata = {"displayname" : "GPS",
24 "exclude" : False,
25 "category" : "Sensors"
26}
27aliases = {"pos_bias_initial" : "Position Bias",
28 "vel_bias_initial" : "Velocity Bias",
29 "mount_frame" : "Spacecraft Body",
30 "mount_position__mf" : "Body Mount Position",
31 "rate_hz" : "Rate Hz",
32 "seed_value" : "EXCLUDE",
33 "earth_rotating_frame" : "Earth Rotating Frame",
34 "max_altitude" : "Max Altitude",
35 "min_altitude" : "EXCLUDE",
36 "max_speed" : "Max Speed",
37 "latency" : "EXCLUDE",
38 "pos_gaussian_noise" : "Position Noise",
39 "vel_gaussian_noise" : "Velocity Noise",
40 "pos_walking_bias_std" : "EXCLUDE",
41 "vel_walking_bias_std" : "EXCLUDE",
42 "meas_pos_GPS_PCR" : "Meas. Position (ECEF)",
43 "perfect_pos_GPS_PCR" : "EXCLUDE",
44 "perfect_accel_sf" : "EXCLUDE",
45 "meas_vel_GPS_PCR" : "Meas. Velocity (ECEF)",
46 "perfect_vel_GPS_PCR" : "EXCLUDE",
47 "longitude_detic" : "EXCLUDE",
48 "latitude_detic" : "EXCLUDE",
49 "altitude_detic" : "EXCLUDE",
50 "is_valid" : "Meas. Validity Flag",
51 "operational_power_draw" : "Operational Power Draw",
52 "mass" : "Mass",
53 "current_power_draw" : "Current Power Draw",
54}
55*/
56
57#ifndef MODELS_SENSORS_GPS_H
58#define MODELS_SENSORS_GPS_H
59
60#include "simulation/Model.h"
61#include "frames/Frame.h"
65#include "constants/unitutils.h"
66#include "utils/LatencyUtil.hpp"
67
68namespace warptwin {
69
93
119
120 MODEL(GPS)
121 public:
122 // Model params
123 // NAME TYPE DEFAULT VALUE
127 SIGNAL(pos_bias_initial, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
130 SIGNAL(vel_bias_initial, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
134 SIGNAL(mount_frame, Frame*, nullptr)
137 SIGNAL(mount_position__mf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
140 SIGNAL(rate_hz, int, 0)
142 SIGNAL(seed_value, int, 0)
145 SIGNAL(earth_rotating_frame, Frame*, nullptr)
148 SIGNAL(max_altitude, double, 18000.0)
150 SIGNAL(min_altitude, double, 0.0)
153 SIGNAL(max_speed, double, 1900.0*warpos::KM_TO_METERS/warpos::HOURS_TO_SECONDS)
157 SIGNAL(latency, int, 0)
160 SIGNAL(operational_power_draw, double, 0.0)
162 SIGNAL(mass, double, 0.0)
164
165 // Model inputs
166 // NAME TYPE DEFAULT VALUE
170 SIGNAL(pos_gaussian_noise, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
173 SIGNAL(vel_gaussian_noise, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
176 SIGNAL(pos_walking_bias_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
179 SIGNAL(vel_walking_bias_std, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
181
182 // Model outputs
183 // NAME TYPE DEFAULT VALUE
188 SIGNAL(output_time, clockwerk::Time, clockwerk::Time(0, 0))
192 SIGNAL(meas_pos_GPS_PCR, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
197 SIGNAL(perfect_pos_GPS_PCR, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
201 SIGNAL(meas_vel_GPS_PCR, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
206 SIGNAL(perfect_vel_GPS_PCR, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
209 SIGNAL(longitude_detic, double, 0.0)
212 SIGNAL(latitude_detic, double, 0.0)
215 SIGNAL(altitude_detic, double, 0.0)
218 SIGNAL(is_valid, bool, false)
221 SIGNAL(current_power_draw, double, 0.0)
223
225 clockwerk::DataIO<Frame*> sensor_frame = clockwerk::DataIO<Frame*>(this, "sensor_frame", &_sensor_frame);
226
229 warptwin::RateMonitor* rateMonitor() {return &_rate_monitor;}
230
233 warptwin::MarkovUncertaintyModel* getNoiseModel() {return &_sensor_noise_model;}
234
235 int16 activate() override;
236 int16 deactivate() override;
237
238 protected:
239 int16 start() override;
240 int16 execute() override;
241
243 void _configureInternal();
244
247
249 MarkovUncertaintyModel _sensor_noise_model;
250
252 RateMonitor _rate_monitor;
253
255 FrameStateSensorModel _state_GPS_PCR;
256
261
263 double _dummy;
264
267
270
273
276
279 };
280
281}
282
283#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
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
CartesianVector3 _perturbed_pos
Internal variables for the perturbed position and velocity.
Definition GPS.h:272
int16 start() override
Class to execute logging.
CartesianVector3 _perturbed_vel
Definition GPS.h:272
double _dummy
Dummy variables for ignoring unneeded function implicit returns.
Definition WorldMagneticFieldModel.h:108
SIGNAL(_mu, double, warpos::earth_wgs84.mu)
CartesianVector3 _previous_vel_bias
Definition GPS.h:269
CartesianVector3 _previous_pos_bias
Internal variables for the previous bias of the position and velocity measurements.
Definition GPS.h:269
MarkovUncertaintyModel _sensor_noise_model
The bias and noise model for sensor output.
Definition Accelerometer.h:240
double _output_alt
Definition GPS.h:266
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
double _truth_altitude
Truth altitude used for dead-zone determination.
Definition GPS.h:258
MODEL(Accelerometer) public warptwin::MarkovUncertaintyModel * getNoiseModel()
Accessor for the internal noise model.
Definition Accelerometer.h:220
int16 execute() override
Function to check monitor input conditions and set trigger flag accordingly. Should be implemented in...
double _output_lon
Internal variables for function implicit returns.
Definition GPS.h:266
RateMonitor _rate_monitor
Rate monitor to control the rate at which the sensor runs.
Definition Accelerometer.h:243
double _output_lat
Definition GPS.h:266
double _latency_return
Temporary value for the return of the latency value.
Definition Servo.h:122
double _truth_speed
Truth speed used for dead-zone determination.
Definition GPS.h:260
FrameStateSensorModel _state_GPS_PCR
Frame state sensor model of the GPS frame relative to the PCR frame.
Definition GPS.h:255
GPS Model.
Definition GPS.h:95
CartesianVector3 meas_vel_GPS_PCR
Definition GPS.h:97
bool is_valid
Definition GPS.h:101
CartesianVector3 meas_pos_GPS_PCR
Definition GPS.h:96
double latitude_detic
Definition GPS.h:99
double altitude_detic
Definition GPS.h:100
_gps_output_struct(CartesianVector3 meas_pos_GPS_PCR, CartesianVector3 meas_vel_GPS_PCR, double longitude_detic, double latitude_detic, double altitude_detic, bool is_valid)
Definition GPS.h:111
double longitude_detic
Definition GPS.h:98
_gps_output_struct()
Definition GPS.h:103