AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
IMUOutputHandler.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
17#include <agxSensor/IMUOutput.h>
19
20#include <optional>
21
22namespace agxSensor
23{
24 using OptionalUniqueId = std::optional<size_t>;
25 using OptionalIMUOutputMappnig = std::optional<std::pair<size_t, IMUOutput*>>;
26
28
33 {
34 public:
39
46 bool add( size_t uniqueId, IMUOutput* output );
47
55
62 template<typename T, IMUOutput::Field... field>
63 bool add( size_t uniqueId );
64
71 template<typename T, IMUOutput::Field... field>
73
79 IMUOutput* get( size_t uniqueId );
80
86 ISensorOutput* getBase( size_t uniqueId ) override;
87
89
90 public:
91 virtual void cleanup() override;
92
94
96
97 protected:
98 using OutputTable = agx::HashTable<size_t, IMUOutputRef>;
99
100 private:
101 OutputTable m_outputs;
102 };
103
104 template<typename T, IMUOutput::Field... field>
105 bool IMUOutputHandler::add( size_t uniqueId )
106 {
107 IMUOutputRef output = new IMUOutput();
108 output->build<field...>();
109 return add( uniqueId, output );
110 }
111
112 template<typename T, IMUOutput::Field... field>
113 OptionalIMUOutputMappnig IMUOutputHandler::add()
114 {
115 IMUOutputRef output = new IMUOutput();
116 output->build<field...>();
117
118 auto uniqueId = add( output );
119 if ( uniqueId )
120 return std::make_pair( *uniqueId, output );
121 else
122 return std::nullopt;
123 }
124}
#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
Handler responsible for how the IMU readings are assembled and provided to the user.
ISensorOutput * getBase(size_t uniqueId) override
Access IMU output instance given the unique id from when it was added.
OptionalUniqueId add(IMUOutput *output)
Add the given IMU output to the output handler.
IMUOutputHandler()
Default constructor.
IMUOutput * get(size_t uniqueId)
Access IMU output instance given the unique id from when it was added.
bool add(size_t uniqueId, IMUOutput *output)
Add the given IMU output to the output handler mapped to the given unique id.
IMU sensor output data where IMUOutput::Field is used to define the data available.
Definition: IMUOutput.h:51
Common interface for sensor output handlers.
Common interface for sensor output data.
Definition: SensorOutput.h:27
System node is a separate step/operation in an execution tree representing a sensor (or such) in a se...
Definition: SystemNode.h:44
Inheritance with partial specialization due to bug with ref_ptr containers.
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, IMUOutput * > > OptionalIMUOutputMappnig
std::optional< size_t > OptionalUniqueId
The agx namespace contains the dynamics/math part of the AGX Dynamics API.