CARLA
 
载入中...
搜索中...
未找到
SemanticLidarMeasurement.h
浏览该文件的文档.
1// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once // 指示这个头文件只应该被包含一次
8
9#include "carla/Debug.h" // 包含CARLA的调试功能
10#include "carla/rpc/Location.h" // 包含CARLA的RPC位置定义
11#include "carla/sensor/data/Array.h" // 包含CARLA传感器数据数组定义
13
14namespace carla {
15namespace sensor {
16namespace data {
17
18 /// 由激光雷达产生的测量结果。包括一系列3D点以及一些关于激光雷达的额外元信息。
19 class SemanticLidarMeasurement : public Array<data::SemanticLidarDetection> { // 定义一个类,继承自Array,用于存储和处理语义Lidar的测量数据
20 static_assert(sizeof(data::SemanticLidarDetection) == 6u * sizeof(float), "SemanticLidarDetection size missmatch"); // 确保SemanticLidarDetection的大小正确
21 using Super = Array<data::SemanticLidarDetection>; // 使用Super作为基类的别名
22
23 protected:
24 using Serializer = s11n::SemanticLidarSerializer; // 使用using声明Serializer为SemanticLidarSerializer的别名,方便后续代码中使用
25
26 friend Serializer; // 允许Serializer访问SemanticLidarMeasurement的私有成员
27
28 explicit SemanticLidarMeasurement(RawData &&data) // 构造函数,接受原始数据
29 : Super(std::move(data), [](const RawData &d) { // 调用基类的构造函数
30 return Serializer::GetHeaderOffset(d); // 获取数据头部的偏移量
31 }) {}
32
33 private:
34
35 auto GetHeader() const { // 私有成员函数,用于获取序列化数据的头部信息
36 return Serializer::DeserializeHeader(Super::GetRawData()); // 调用Serializer的静态方法DeserializeHeader,从基类的RawData中反序列化头部信息
37 }
38
39 public:
40
41 /// 测量时激光雷达的水平角度。
42 auto GetHorizontalAngle() const { // 获取Lidar的水平角度
43 return GetHeader().GetHorizontalAngle(); // 从头部信息中获取水平角度
44 }
45
46 /// 激光雷达的通道数量。
47 auto GetChannelCount() const { // 获取Lidar的通道数
48 return GetHeader().GetChannelCount(); // 从头部信息中获取通道数
49 }
50
51 /// 获取由特定通道生成的点的数量。点是按通道排序的,因此这个方法可以用来识别生成每个点的通道。
52 ///
53 auto GetPointCount(size_t channel) const { // 获取特定通道生成的点的数量
54 return GetHeader().GetPointCount(channel); // 从头部信息中获取特定通道的点的数量
55 }
56 };
57
58} // namespace data
59} // namespace sensor
60} // namespace carla
包装一个传感器生成的原始数据以及一些有用的元信息。
Definition RawData.h:20
所有传感器数据的基类,包含一个项目数组。
Definition Array.h:23
Helper class to store and serialize the data generated by a RawLidar.
由激光雷达产生的测量结果。包括一系列3D点以及一些关于激光雷达的额外元信息。
auto GetHorizontalAngle() const
测量时激光雷达的水平角度。
auto GetChannelCount() const
激光雷达的通道数量。
auto GetPointCount(size_t channel) const
获取由特定通道生成的点的数量。点是按通道排序的,因此这个方法可以用来识别生成每个点的通道。
Serializes the data generated by Lidar sensors.
static size_t GetHeaderOffset(const RawData &data)
static SemanticLidarHeaderView DeserializeHeader(const RawData &data)
CARLA模拟器的主命名空间。
Definition Carla.cpp:139