AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
LidarRayPatternFromFile.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
19namespace agxSensor
20{
21
23 {
24 std::string
26 bool twoColumns = false;
27 bool anglesInDegrees = false;
28 bool firstLineIsHeader = true;
29 char delimiter = ',';
30 };
31
32
34
35
38 class AGXSENSOR_EXPORT LidarPatternRayArchive
39 {
40 public:
41 LidarPatternRayArchive();
42
48 bool read(const agx::String& path);
49
55 bool write(const agx::String& path);
56
57
58 virtual ~LidarPatternRayArchive() = default;
59
60 protected:
61 bool read(agxStream::InputArchive& in);
62 bool write(agxStream::OutputArchive& out) const;
63 friend class LidarRayPatternFromFile;
64 std::shared_ptr<LidarRayPatternStorage> m_storage;
65 };
67
68
70
88 {
89 public:
94
103 agxSensor::RayFileDefinition rayFileDefinition, agx::Real frequency, size_t frameSize, size_t downsample = 1);
104
111 static bool createPatternArchiveFromFile(RayFileDefinition rayFileDefinition, LidarPatternRayArchive& storage);
112
113
115
116 public:
117 virtual LidarRayPatternInterval getNextInterval(agx::Real dt) override;
118 virtual size_t getNumRays() const override;
119
121
123
124 protected:
125 static bool createPatternFromFile(RayFileDefinition rayFileDefinition, LidarRayPatternStorage& storage);
126 virtual ~LidarRayPatternFromFile() = default;
127
128 private:
129 struct PatternState
130 {
131 agx::Real elapsedTime = 0.0;
132 agx::Real frameTime = 0.0;
133 size_t frameSize = 0;
134 size_t last = std::numeric_limits<size_t>::max();
135 };
136
137
138 private:
139 PatternState m_state;
140 std::shared_ptr<LidarRayPatternStorage> m_pattern;
141 };
142}
#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
Ray pattern that is read from an external file (.csv or compact binary file).
LidarRayPatternFromFile(agxSensor::RayFileDefinition rayFileDefinition, agx::Real frequency, size_t frameSize, size_t downsample=1)
Construct from CSV file.
LidarRayPatternFromFile()
Default constructor, zero rays.
static bool createPatternArchiveFromFile(RayFileDefinition rayFileDefinition, LidarPatternRayArchive &storage)
Read a RayFilePattern file from disk and fill in the data in the storage argument.
Base of lidar ray pattern implementations responsible of providing a set of ray transforms (ray along...
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
#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...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:41
Ray pattern interval (index range) with a start index and size.
bool firstLineIsHeader
If true: ignore first line.
bool twoColumns
If true: file has only azimuth,elevation (no first column)
bool anglesInDegrees
If true: angles are in degrees, else radians.
std::string path
Absolute or relative file path, if filetype != ".csv" the rest of the parameters are ignored.