CARLA
LidarMeasurement.h
Go to the documentation of this file.
1 // Copyright (c) 2017 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"
10 #include "carla/rpc/Location.h"
13 
14 namespace carla {
15 namespace sensor {
16 namespace data {
17 
18  /// Measurement produced by a Lidar. Consists of an array of 3D points plus
19  /// some extra meta-information about the Lidar.
20  class LidarMeasurement : public Array<data::LidarDetection> {
21  static_assert(sizeof(data::LidarDetection) == 4u * sizeof(float), "Location size missmatch");
23 
24  protected:
26 
27  friend Serializer;
28 
30  : Super(std::move(data), [](const RawData &d) {
32  }) {}
33 
34  private:
35 
36  auto GetHeader() const {
38  }
39 
40  public:
41  /// Horizontal angle of the Lidar at the time of the measurement.
42  auto GetHorizontalAngle() const {
43  return GetHeader().GetHorizontalAngle();
44  }
45 
46  /// Number of channels of the Lidar.
47  auto GetChannelCount() const {
48  return GetHeader().GetChannelCount();
49  }
50 
51  /// Retrieve the number of points that @a channel generated. Points are
52  /// sorted by channel, so this method allows to identify the channel that
53  /// generated each point.
54  auto GetPointCount(size_t channel) const {
55  return GetHeader().GetPointCount(channel);
56  }
57  };
58 
59 } // namespace data
60 } // namespace sensor
61 } // namespace carla
auto GetPointCount(size_t channel) const
Retrieve the number of points that channel generated.
Serializes the data generated by Lidar sensors.
Measurement produced by a Lidar.
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
static size_t GetHeaderOffset(const RawData &data)
auto GetHorizontalAngle() const
Horizontal angle of the Lidar at the time of the measurement.
static LidarHeaderView DeserializeHeader(const RawData &data)
auto GetChannelCount() const
Number of channels of the Lidar.
Base class for all the sensor data consisting of an array of items.
Definition: Array.h:23
Helper class to store and serialize the data generated by a Lidar.
Definition: LidarData.h:47
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition: RawData.h:20