CARLA
SensorData.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/Memory.h"
10 #include "carla/NonCopyable.h"
11 #include "carla/sensor/RawData.h"
12 
13 /// @todo This shouldn't be exposed in this namespace.
15 
16 namespace carla {
17 namespace sensor {
18 
19  /// Base class for all the objects containing data generated by a sensor.
20  class SensorData
21  : public EnableSharedFromThis<SensorData>,
22  private NonCopyable {
23  protected:
24 
25  SensorData(size_t frame, double timestamp, const rpc::Transform &sensor_transform)
26  : _frame(frame),
27  _timestamp(timestamp),
28  _sensor_transform(sensor_transform) {}
29 
30  explicit SensorData(const RawData &data)
31  : SensorData(data.GetFrame(), data.GetTimestamp(), data.GetSensorTransform()) {}
32 
33  public:
34 
35  virtual ~SensorData() = default;
36 
37  /// Frame count when the data was generated.
38  size_t GetFrame() const {
39  return _frame;
40  }
41 
42  /// Simulation-time when the data was generated.
43  double GetTimestamp() const {
44  return _timestamp;
45  }
46 
47  /// Sensor's transform when the data was generated.
49  return _sensor_transform;
50  }
51 
52  protected:
53 
54  const auto &GetEpisode() const {
55  return _episode;
56  }
57 
58  private:
59 
60  /// @todo This shouldn't be exposed in this namespace.
63 
64  const size_t _frame;
65 
66  const double _timestamp;
67 
69  };
70 
71 } // namespace sensor
72 } // namespace carla
size_t GetFrame() const
Frame count when the data was generated.
Definition: SensorData.h:38
const rpc::Transform & GetSensorTransform() const
Sensor&#39;s transform when the data was generated.
Definition: SensorData.h:48
client::detail::WeakEpisodeProxy _episode
Definition: SensorData.h:62
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
const rpc::Transform _sensor_transform
Definition: SensorData.h:68
virtual ~SensorData()=default
const auto & GetEpisode() const
Definition: SensorData.h:54
SensorData(size_t frame, double timestamp, const rpc::Transform &sensor_transform)
Definition: SensorData.h:25
Base class for all the objects containing data generated by a sensor.
Definition: SensorData.h:20
Connects and controls a CARLA Simulator.
Definition: Simulator.h:49
SensorData(const RawData &data)
Definition: SensorData.h:30
const double _timestamp
Definition: SensorData.h:66
double GetTimestamp() const
Simulation-time when the data was generated.
Definition: SensorData.h:43
Inherit (privately) to suppress copy/move construction and assignment.
EpisodeProxyImpl< EpisodeProxyPointerType::Weak > WeakEpisodeProxy
Definition: EpisodeProxy.h:71
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition: RawData.h:21