AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
TriaxialOutput.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
19
20#include <agx/Referenced.h>
21
22namespace agxSensor
23{
25
46 {
47 public:
48 enum Field : int32_t
49 {
57 NUM_FIELDS
58 };
59
60 using FieldVector = std::vector<Field>;
61
62 public:
67 static size_t sizeOf( Field field );
68
73 static const char* getFieldName( Field field );
74
75 public:
79 TriaxialOutput() = default;
80
84 template<Field... field>
85 void build();
86
93
98 virtual size_t getElementSize() const override;
99
103 virtual const BinaryOutputBuffer& getData() override;
104
112 virtual bool hasUnreadData( bool markAsRead = true ) override;
113
117 bool contains(Field field) const;
118
125 size_t getOffset(Field field) const;
126
130 const FieldVector& getFields() const;
131
137
139
140 public:
141 virtual ~TriaxialOutput() = default;
142
143 virtual void result( const CallbackData& data ) override;
144 virtual void cleanup() override;
145
147
149
150 private:
151 FieldVector m_fields{};
152 size_t m_elementSize{ 0u };
153 bool m_hasUnreadData{ false };
154 BinaryOutputBuffer m_output{};
155 };
156
157 template<TriaxialOutput::Field... field>
159 {
160 m_fields.clear();
161 m_elementSize = 0u;
162 ( this->add( field ), ... );
163 }
164
166
167 #pragma pack(push, 1)
168 struct TriaxialXYZValue
169 {
170 agx::Real x, y, z;
171
172 inline TriaxialXYZValue() {}
173 inline TriaxialXYZValue( const agx::Vec3& v )
174 : x( v.x() )
175 , y( v.y() )
176 , z( v.z() )
177 {
178 }
179 inline TriaxialXYZValue( const TriaxialXYZValue& ) = default;
180 inline TriaxialXYZValue& operator=( const TriaxialXYZValue& ) = default;
181
182 inline agx::Vec3 asVec3() const
183 {
184 return agx::Vec3( x, y, z );
185 }
186 };
187 #pragma pack(pop)
188
189 class AGXSENSOR_EXPORT TriaxialOutputXYZ : public TriaxialOutput
190 {
191 public:
192 TriaxialOutputXYZ();
193 };
194
196}
#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
Buffer used for sensor output of a wide range of output element types.
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
Triaxial sensor output data where TriaxialOutput::Field is used to define the data available.
virtual size_t getElementSize() const override
"Element size" is the summed data size of the currently added fields.
std::vector< Field > FieldVector
bool contains(Field field) const
static size_t sizeOf(Field field)
virtual bool hasUnreadData(bool markAsRead=true) override
size_t getOffset(Field field) const
Offset in bytes of the first entry of field in the pack of fields.
TriaxialOutput()=default
Default constructor.
void build()
Add one or more fields, build a matching data structure.
static const char * getFieldName(Field field)
agx::Vec3 computeCovariance() const
Compute the covariance of the triaxial signal values at this output.
virtual const BinaryOutputBuffer & getData() override
const FieldVector & getFields() const
TriaxialOutput & add(Field field)
Add new field.
@ Y_VALUE_F64
1x 64-bit floating point y-axis output.
@ Z_VALUE_F64
1x 64-bit floating point z-axis output.
@ X_VALUE_F64
1x 64-bit floating point x-axis output.
#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...
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: agx/Vec3.h:36
double Real
Definition: Real.h:41