AGX Dynamics 2.42.1.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
115
116 public:
117 virtual ~TriaxialOutput() = default;
118
119 virtual void result( const CallbackData& data ) override;
120 virtual void cleanup() override;
121
123
125
126 private:
127 FieldVector m_fields{};
128 size_t m_elementSize{ 0u };
129 bool m_hasUnreadData{ false };
130 BinaryOutputBuffer m_output{};
131 };
132
133 template<TriaxialOutput::Field... field>
135 {
136 m_fields.clear();
137 m_elementSize = 0u;
138 ( this->add( field ), ... );
139 }
140
142
143 #pragma pack(push, 1)
144 struct TriaxialXYZValue
145 {
146 agx::Real x, y, z;
147
148 inline TriaxialXYZValue() {}
149 inline TriaxialXYZValue( const agx::Vec3& v )
150 : x( v.x() )
151 , y( v.y() )
152 , z( v.z() )
153 {
154 }
155 inline TriaxialXYZValue( const TriaxialXYZValue& ) = default;
156 inline TriaxialXYZValue& operator=( const TriaxialXYZValue& ) = default;
157
158 inline agx::Vec3 asVec3() const
159 {
160 return agx::Vec3( x, y, z );
161 }
162 };
163 #pragma pack(pop)
164
165 class AGXSENSOR_EXPORT TriaxialOutputXYZ : public TriaxialOutput
166 {
167 public:
168 TriaxialOutputXYZ();
169 };
170
172}
#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
static size_t sizeOf(Field field)
virtual bool hasUnreadData(bool markAsRead=true) override
TriaxialOutput()=default
Default constructor.
void build()
Add one or more fields, build a matching data structure.
static const char * getFieldName(Field field)
virtual const BinaryOutputBuffer & getData() override
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