24 class SemanticLidarSerializer;
25 class SemanticLidarHeaderView;
59 float cos_inc_angle{};
60 uint32_t object_idx{};
61 uint32_t object_tag{};
66 point(x, y, z), cos_inc_angle{cosTh}, object_idx{idx}, object_tag{tag} { }
68 point(p), cos_inc_angle{cosTh}, object_idx{idx}, object_tag{tag} { }
71 out <<
"property float32 x\n" \
72 "property float32 y\n" \
73 "property float32 z\n" \
74 "property float32 CosAngle\n" \
75 "property uint32 ObjIdx\n" \
76 "property uint32 ObjTag";
80 out << point.x <<
' ' << point.y <<
' ' << point.z <<
' ' \
81 << cos_inc_angle <<
' ' << object_idx <<
' ' << object_tag;
87 static_assert(
sizeof(
float) ==
sizeof(uint32_t),
"Invalid float size");
98 : _header(
Index::SIZE + ChannelCount, 0u) {
99 _header[Index::ChannelCount] = ChannelCount;
107 return reinterpret_cast<const float &
>(_header[Index::HorizontalAngle]);
111 std::memcpy(&_header[Index::HorizontalAngle], &angle,
sizeof(uint32_t));
115 return _header[Index::ChannelCount];
118 virtual void ResetMemory(std::vector<uint32_t> points_per_channel) {
119 DEBUG_ASSERT(GetChannelCount() > points_per_channel.size());
120 std::memset(_header.data() +
Index::SIZE, 0,
sizeof(uint32_t) * GetChannelCount());
122 uint32_t total_points =
static_cast<uint32_t
>(
123 std::accumulate(points_per_channel.begin(), points_per_channel.end(), 0));
126 _ser_points.reserve(total_points);
130 for (
auto idxChannel = 0u; idxChannel < GetChannelCount(); ++idxChannel)
131 _header[
Index::SIZE + idxChannel] = points_per_channel[idxChannel];
135 _ser_points.emplace_back(detection);
SemanticLidarData(uint32_t ChannelCount=0u)
void WriteDetection(std::ostream &out) const
uint32_t GetChannelCount() const
virtual void WriteChannelCount(std::vector< uint32_t > points_per_channel)
static const FString SIZE
Helper class to store and serialize the data generated by a RawLidar.
This file contains definitions of common data structures used in traffic manager. ...
std::vector< SemanticLidarDetection > _ser_points
virtual ~SemanticLidarData()
#define DEBUG_ASSERT(predicate)
Serializes the data generated by Lidar sensors.
SemanticLidarDetection(geom::Location p, float cosTh, uint32_t idx, uint32_t tag)
virtual void ResetMemory(std::vector< uint32_t > points_per_channel)
virtual void WritePointSync(SemanticLidarDetection &detection)
std::vector< uint32_t > _header
void WritePlyHeaderInfo(std::ostream &out) const
SemanticLidarDetection(float x, float y, float z, float cosTh, uint32_t idx, uint32_t tag)
void SetHorizontalAngle(float angle)
uint32_t _max_channel_points
float GetHorizontalAngle() const