AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
OdometerOutputHandler.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16#pragma once
22
23#include <optional>
24#include <utility>
25
26namespace agxSensor
27{
28 using OptionalUniqueId = std::optional<size_t>;
29 using OptionalOdometerOutputMapping = std::optional<std::pair<size_t, OdometerOutput*>>;
30
32
37 {
38 public:
43
50 bool add( size_t uniqueId, OdometerOutput* output );
51
59
66 template<typename T, OdometerOutput::Field... field>
67 bool add( size_t uniqueId );
68
75 template<typename T, OdometerOutput::Field... field>
77
83 OdometerOutput* get( size_t uniqueId );
84
90 ISensorOutput* getBase( size_t uniqueId ) override;
91
98
107
112 bool contains( const MonoaxialGaussianNoise* noise ) const;
113
119 bool add( MonoaxialSignalResolution* resolution );
120
128
133 bool contains( const MonoaxialSignalResolution* resolution ) const;
134
140 bool add( MonoaxialSignalScaling* scaling );
141
150
155 bool contains( const MonoaxialSignalScaling* scaling ) const;
156
161
163
164 public:
165 virtual void synchronize( const CallbackData& data ) override;
166 virtual void cleanup() override;
167
169
170 protected:
171 using OutputTable = agx::HashTable<size_t, OdometerOutputRef>;
172
173 protected:
174 bool addModifierInternal( IMonoaxialSignalSystemNode* node );
175 bool removeModifierInternal( IMonoaxialSignalSystemNode* node );
176 bool containsModifierInternal( const IMonoaxialSignalSystemNode* node ) const;
177
179
180 protected:
181 OutputTable m_outputs;
183 SystemNodeRef m_signalAssembler;
185 SystemNodeRef m_tailNode;
186 };
187
188 template<typename T, OdometerOutput::Field... field>
189 bool OdometerOutputHandler::add( size_t uniqueId )
190 {
191 OdometerOutputRef output = new OdometerOutput();
192 output->build<field...>();
193 return add( uniqueId, output );
194 }
195
196 template<typename T, OdometerOutput::Field... field>
197 OptionalOdometerOutputMapping OdometerOutputHandler::add()
198 {
199 OdometerOutputRef output = new OdometerOutput();
200 output->build<field...>();
201
202 auto uniqueId = add( output );
203 if ( uniqueId )
204 return std::make_pair( *uniqueId, output );
205 else
206 return std::nullopt;
207 }
208}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXSENSOR_EXPORT
Interface for implementation details for system nodes carrying a monoaxial signal.
Common interface for sensor output handlers.
Common interface for sensor output data.
Definition: SensorOutput.h:27
Applies a total Gaussian noise to the monoaxial signal based on a specified noise RMS.
Applies resolution binning to a monoaxial signal.
Applies a constant scaling to the monoaxial signal.
Handler responsible for how the odometer readings are assembled and provided to the user.
OptionalUniqueId add(OdometerOutput *output)
Add the given odometer output to the output handler.
OdometerOutputHandler()
Default constructor.
OdometerOutput * get(size_t uniqueId)
Access odometer output instance given the unique id from when it was added.
bool contains(const MonoaxialSignalScaling *scaling) const
IMonoaxialSignalSystemNodeRefVector getOutputModifiers() const
ISensorOutput * getBase(size_t uniqueId) override
Access odometer output instance given the unique id from when it was added.
bool contains(const MonoaxialSignalResolution *resolution) const
bool remove(MonoaxialSignalScaling *scaling)
Remove the signal scaling instance from the system tree.
bool remove(MonoaxialGaussianNoise *noise)
Remove the Gaussian noise instance from the system tree.
bool remove(MonoaxialSignalResolution *resolution)
Remove the resolution binning instance from the system tree.
bool add(MonoaxialSignalResolution *resolution)
Add a resolution binning instance to the system tree.
bool add(size_t uniqueId, OdometerOutput *output)
Add the given odometer output to the output handler mapped to the given unique id.
bool add(MonoaxialSignalScaling *scaling)
Add a signal scaling instance to the system tree.
bool contains(const MonoaxialGaussianNoise *noise) const
bool add(MonoaxialGaussianNoise *noise)
Add a Gaussian noise instance to the system tree.
Odometer sensor output data where OdometerOutput::Field is used to define the data available.
System node is a separate step/operation in an execution tree representing a sensor (or such) in a se...
Definition: SystemNode.h:44
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
The agxSensor namespace contains components to model real-time sensors connected to the physics of AG...
std::optional< std::pair< size_t, OdometerOutput * > > OptionalOdometerOutputMapping
std::optional< size_t > OptionalUniqueId
The agx namespace contains the dynamics/math part of the AGX Dynamics API.