CARLA
 
载入中...
搜索中...
未找到
ServerSideSensor.h
浏览该文件的文档.
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
10#include <bitset>
11
12namespace carla {
13namespace client {
14
15 class ServerSideSensor final : public Sensor {
16 public:
17
18 using Sensor::Sensor;
19
21
22 /// Register a @a callback to be executed each time a new measurement is
23 /// received.
24 ///
25 /// @warning Calling this function on a sensor that is already listening
26 /// steals the data stream from the previously set callback. Note that
27 /// several instances of Sensor (even in different processes) may point to
28 /// the same sensor in the simulator.
29 void Listen(CallbackFunctionType callback) override;
30
31 /// Stop listening for new measurements.
32 void Stop() override;
33
34 /// Return whether this Sensor instance is currently listening to the
35 /// associated sensor in the simulator.
36 bool IsListening() const override {
37 return listening_mask.test(0);
38 }
39
40 /// Listen fr
41 void ListenToGBuffer(uint32_t GBufferId, CallbackFunctionType callback);
42
43 /// Stop listening for a specific gbuffer stream.
44 void StopGBuffer(uint32_t GBufferId);
45
46 inline bool IsListeningGBuffer(uint32_t id) const {
47 return listening_mask.test(id + 1);
48 }
49
50 /// Enable this sensor for ROS2 publishing
51 void EnableForROS();
52
53 /// Disable this sensor for ROS2 publishing
54 void DisableForROS();
55
56 /// Return if the sensor is publishing for ROS2
57 bool IsEnabledForROS();
58
59 /// Send data via this sensor
60 void Send(std::string message);
61
62 /// @copydoc Actor::Destroy()
63 ///
64 /// Additionally stop listening.
65 bool Destroy() override;
66
67 private:
68
69 std::bitset<16> listening_mask;
70 };
71
72} // namespace client
73} // namespace carla
std::function< void(SharedPtr< sensor::SensorData >)> CallbackFunctionType
bool IsEnabledForROS()
Return if the sensor is publishing for ROS2
bool IsListeningGBuffer(uint32_t id) const
void EnableForROS()
Enable this sensor for ROS2 publishing
void ListenToGBuffer(uint32_t GBufferId, CallbackFunctionType callback)
Listen fr
void Send(std::string message)
Send data via this sensor
void Stop() override
Stop listening for new measurements.
void DisableForROS()
Disable this sensor for ROS2 publishing
bool IsListening() const override
Return whether this Sensor instance is currently listening to the associated sensor in the simulator.
void Listen(CallbackFunctionType callback) override
Register a callback to be executed each time a new measurement is received.
void StopGBuffer(uint32_t GBufferId)
Stop listening for a specific gbuffer stream.
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133