AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
LidarRayPatternGenerator.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
18
20
23
24#include <memory>
25
26#ifdef _MSC_VER
27 #pragma warning(push)
28 #pragma warning(disable : 4251) // Disable warnings about members needing dll interface.
29#endif
30
31namespace agxSensor
32{
33 struct LidarRayPatternStorage;
34 struct LidarRayPatternInterval;
35 struct RtNode;
36
38
45 {
46 public:
51
59 void setRayTransforms(const agx::AffineMatrix4x4Vector& rayTransforms);
60
66
67 public:
71 virtual ~LidarRayPatternGenerator() = default;
72
80
84 virtual size_t getNumRays() const;
85
87
88 public:
89 virtual RtNode* createNode() override;
90 virtual void synchronize(RtSystemNodeProxy& node, const CallbackData& data) override;
91
92 virtual void store(agxStream::OutputArchive& out) const override;
93 virtual void restore(agxStream::InputArchive& in) override;
94
95 void store(agxStream::OutputArchive& out, bool storeTransforms) const;
96 void restore(agxStream::InputArchive& in, bool restoreTransforms);
97
98 protected:
99 template <typename ContainerT>
100 static void writeTransforms(agxStream::OutputArchive& out, const ContainerT& container);
101
102 template <typename ContainerT>
103 static void readTransforms(agxStream::InputArchive& in, ContainerT& container);
104
105 protected:
106 LidarRayPatternStorage* getStorage();
107 const LidarRayPatternStorage* getStorage() const;
108
110
111 private:
112 void updateRayTransforms(RtNode* node, agx::Real dt);
113
114 private:
115 std::shared_ptr<LidarRayPatternStorage> m_storage;
116 };
117
118 template <typename ContainerT>
119 void LidarRayPatternGenerator::writeTransforms(agxStream::OutputArchive& out, const ContainerT& container)
120 {
121 const size_t numRayTransforms = container.size();
122 out << agxStream::out("numRayTransforms", numRayTransforms);
123
124 out.beginSection("rayTransforms");
125 out.write(container.data(), sizeof(typename ContainerT::value_type) * numRayTransforms);
126 out.endSection("rayTransforms");
127 }
128
129 template <typename ContainerT>
130 void LidarRayPatternGenerator::readTransforms(agxStream::InputArchive& in, ContainerT& container)
131 {
132 size_t numRayTransforms = 0u;
133 in >> agxStream::in("numRayTransforms", numRayTransforms);
134
135 container.resize(numRayTransforms);
136 in.beginSection("rayTransforms");
137 in.read(container.data(), sizeof(typename ContainerT::value_type) * numRayTransforms);
138 in.endSection("rayTransforms");
139 }
140
141
146 {
151
159 : first(first)
160 , numRays(numRays)
161 {
162 }
163
164 agx::Int32 first {0};
165 agx::Int32 numRays {0};
166 };
167}
168
169#ifdef _MSC_VER
170 #pragma warning(pop)
171#endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXSENSOR_EXPORT
Interface as RtSystemNode for model specific implementations that is part of the system tree of lidar...
Base of lidar ray pattern implementations responsible of providing a set of ray transforms (ray along...
virtual size_t getNumRays() const
virtual ~LidarRayPatternGenerator()=default
Destructor.
void setRayTransforms(const agx::AffineMatrix4x4Vector &rayTransforms)
Assign all, locally possible, ray transforms.
virtual LidarRayPatternInterval getNextInterval(agx::Real dt)=0
Provides the active ray index range for a given step length dt.
void applyTransform(const agx::AffineMatrix4x4 &rhs)
Apply delta transform to all current ray transforms.
LidarRayPatternGenerator()
Default constructor.
Raytrace system node acting as a clone of model specific implementations.
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#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...
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:401
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
int32_t Int32
Definition: Integer.h:37
double Real
Definition: Real.h:41
STL namespace.
Ray pattern interval (index range) with a start index and size.
LidarRayPatternInterval()=default
Default interval of zero size and start index 0.
LidarRayPatternInterval(agx::Int32 first, agx::Int32 numRays)
Construct given start index first and number of size numRays from first.
A node performs a single operation, e.g., raycast, gaussian blur, merging etc.