ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
SimpleCameraSensor.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/*
17Camera sensor model header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef MODELS_SENSORS_SIMPLE_CAMERA_SENSOR_H
23#define MODELS_SENSORS_SIMPLE_CAMERA_SENSOR_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 Simple Camera Model
38 *
39 *
40 *
41 * Author: Alex Reynolds <alex.reynolds@attx.tech>
42 */
43 class SimpleCameraSensor : public Model {
44 public:
45 // Model params
46 // NAME TYPE DEFAULT VALUE
48 /** The frame of the object being sensed by the simple camera model. */
50 /** The bias in the alpha angle measurement output described as a single scalar, with angle
51 * in RADIANS. This parameter may account for a number of factors, including misalignment,
52 * measurement bias, etc. Default is no bias. */
53 SIGNAL(alpha_bias, double, 0.0)
54 /** The bias in the beta angle measurement output described as a single scalar, with angle
55 * in RADIANS. This parameter may account for a number of factors, including misalignment,
56 * measurement bias, etc. Default is no bias. */
57 SIGNAL(beta_bias, double, 0.0)
58 /** The one-sigma gaussian noise in alpha measurement output described as a scalar,
59 * with angle in RADIANS. Default is no noise. */
60 SIGNAL(alpha_gaussian_noise, double, 0.0)
61 /** The one-sigma gaussian noise in beta measurement output described as a scalar,
62 * with angle in RADIANS. Default is no noise. */
63 SIGNAL(beta_gaussian_noise, double, 0.0)
64 /** The vehicle frame relative to which the camera is mounted and aligned. This is most
65 * typically the body frame of a spacecraft or other vehicle. mount_position__mf and mount_alignment__mf
66 * are described relative to this frame. */
67 SIGNAL(mount_frame, FrameD*, nullptr)
68 /** The position of the camera in the mount frame, represented in the default simulation
69 * unit (meters by default. pretty much always meters) */
71 /** The alignment of the camera relative to the mount frame */
72 SIGNAL(mount_alignment_mf, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
73 /** The rate at which the camera generates an output, in hertz. Setting this value
74 * to 0 forces the camera to output at the simulation rate. */
75 SIGNAL(rate_hz, int, 0)
76 /** Value to seed the internal RNG for this model. */
77 SIGNAL(seed_value, int, 0)
79
80 // Model inputs
81 // NAME TYPE DEFAULT VALUE
83
85
86 // Model outputs
87 // NAME TYPE DEFAULT VALUE
89 /** The alpha angle measurement output produced from the camera describing the
90 * location of the target object frame relative to the reference frame plus
91 * appropriate bias, noise, and rate limiting. */
92 SIGNAL(measured_alpha, double, 0.0)
93 /** The beta angle measurement output produced from the camera describing the
94 * location of the target object frame relative to the reference frame plus
95 * appropriate bias, noise, and rate limiting. */
96 SIGNAL(measured_beta, double, 0.0)
97 /** The alpha angle measurement output produced from the camera describing the
98 * location of the target object frame relative to the reference frame without
99 * noise or error. This parameter is informational. */
100 SIGNAL(perfect_alpha, double, 0.0)
101 /** The beta angle measurement output produced from the camera describing the
102 * location of the target object frame relative to the reference frame without
103 * noise or error. This parameter is informational. */
104 SIGNAL(perfect_beta, double, 0.0)
106
107 /// @brief Accessor for the sensor's frame
108 clockwerk::DataIO<FrameD*> sensor_frame = clockwerk::DataIO<FrameD*>(this, "sensor_frame", &_sensor_frame);
109
110 /// @brief Accessor for the internal bias and noise model
111 /// @return Pointer to the bias noise model
113
114 /// @brief Accessor for the internal rate monitor model
115 /// @return Pointer to the rate monitor model
117
118 // Model-specific implementations of startup and derivative
119 SimpleCameraSensor(Model &pnt, const std::string &m_name="simple_camera");
120 SimpleCameraSensor(SimulationExecutive &e, const std::string &m_name="simple_camera");
121 SimpleCameraSensor(Model &pnt, int schedule_slot, const std::string &m_name="simple_camera");
122 SimpleCameraSensor(SimulationExecutive &e, int schedule_slot, const std::string &m_name="simple_camera");
123 virtual ~SimpleCameraSensor() {}
124 protected:
125 int start();
126 int execute();
127
128 /// @brief Function to configure sensor -- runs in all constructors
129 void _configureInternal();
130
131 /// @brief The sensor frame in which all measurements will be taken
133
134 /// @brief The bias and noise model for sensor output.
136
137 /// @brief Rate monitor to control the rate at which the sensor runs
139
140 // Temporary DCM to hold temporary attitude calculations
141 DCMD _tmp_dcm;
142
143 // Internal variable to hold full bias and noise
144 CartesianVector3D _pos_tgt_mount__mount;
145 };
146
147}
148
149#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
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
Simple Camera Model.
Definition SimpleCameraSensor.h:43
modelspace::BiasNoiseModel * biasNoiseModel()
Accessor for the internal bias and noise model.
Definition SimpleCameraSensor.h:112
int start()
Function to perform task startup activities (step once after creation)
Definition SimpleCameraSensor.cpp:67
void _configureInternal()
Function to configure sensor – runs in all constructors.
Definition SimpleCameraSensor.cpp:53
RateMonitor _rate_monitor
Rate monitor to control the rate at which the sensor runs.
Definition SimpleCameraSensor.h:138
modelspace::RateMonitor * rateMonitor()
Accessor for the internal rate monitor model.
Definition SimpleCameraSensor.h:116
clockwerk::DataIO< clockwerk::Frame< double > * > sensor_frame
Accessor for the sensor's frame.
Definition SimpleCameraSensor.h:108
int execute()
Function to execute the task. All math and calculations should be here.
Definition SimpleCameraSensor.cpp:102
BiasNoiseModel _sensor_bias_noise
The bias and noise model for sensor output.
Definition SimpleCameraSensor.h:135
clockwerk::Frame< double > _sensor_frame
The sensor frame in which all measurements will be taken.
Definition SimpleCameraSensor.h:132
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< double > perfect_beta
Definition SimpleCameraSensor.h:104
clockwerk::DataIO< double > measured_beta
Definition SimpleCameraSensor.h:96
clockwerk::DataIO< double > perfect_alpha
Definition SimpleCameraSensor.h:100
clockwerk::DataIO< double > measured_alpha
Definition SimpleCameraSensor.h:92
clockwerk::DataIO< double > beta_bias
Definition SimpleCameraSensor.h:57
clockwerk::DataIO< clockwerk::Frame< double > * > target_obj_frame
Definition SimpleCameraSensor.h:49
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > mount_position__mf
Definition SimpleCameraSensor.h:70
clockwerk::DataIO< int > seed_value
Definition SimpleCameraSensor.h:77
clockwerk::DataIO< double > beta_gaussian_noise
Definition SimpleCameraSensor.h:63
clockwerk::DataIO< double > alpha_bias
Definition SimpleCameraSensor.h:53
clockwerk::DataIO< clockwerk::Frame< double > * > mount_frame
Definition SimpleCameraSensor.h:67
clockwerk::DataIO< int > rate_hz
Definition SimpleCameraSensor.h:75
clockwerk::DataIO< double > alpha_gaussian_noise
Definition SimpleCameraSensor.h:60
clockwerk::DataIO< clockwerk::Quaternion< double > > mount_alignment_mf
Definition SimpleCameraSensor.h:72