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 /// 注册一个 @a 回调,每次收到新的测量值时执行。
23 ///
24 /// @warning 在已在监听的传感器上调用此函数会窃取先前设置的回调中的数据流。
25 /// 请注意,多个传感器实例(即使在不同的进程中)可能指向模拟器中的同一传感器。
26 void Listen(CallbackFunctionType callback) override;
27
28 /// 停止监听新的测量结果。
29 void Stop() override;
30
31 /// 返回此传感器实例当前是否正在监听模拟器中的相关传感器。
32 bool IsListening() const override {
33 return listening_mask.test(0);
34 }
35
36 /// 监听 fr
37 void ListenToGBuffer(uint32_t GBufferId, CallbackFunctionType callback);
38
39 /// 停止监听特定的 gbuffer 流。
40 void StopGBuffer(uint32_t GBufferId);
41 // 检查指定ID是否在监听缓冲区中。
42 inline bool IsListeningGBuffer(uint32_t id) const {
43 return listening_mask.test(id + 1);
44 }
45
46 /// 启用此传感器以进行 ROS2 发布
47 void EnableForROS();
48
49 /// 禁用此传感器以进行 ROS2 发布
50 void DisableForROS();
51
52 /// 如果传感器正在为 ROS2 发布,则返回
53 bool IsEnabledForROS();
54
55 /// 通过该传感器发送数据
56 void Send(std::string message);
57
58 /// @copydoc Actor::Destroy()
59 ///
60 /// 另外停止监听。
61 bool Destroy() override;
62
63 private:
64
65 std::bitset<16> listening_mask;
66 };
67
68} // namespace client
69} // namespace carla
传感器基类,继承自Actor类。
std::function< void(SharedPtr< sensor::SensorData >)> CallbackFunctionType
回调函数的类型别名,用于接收传感器数据。
bool IsEnabledForROS()
如果传感器正在为 ROS2 发布,则返回
bool IsListeningGBuffer(uint32_t id) const
void EnableForROS()
启用此传感器以进行 ROS2 发布
void ListenToGBuffer(uint32_t GBufferId, CallbackFunctionType callback)
监听 fr
void Send(std::string message)
通过该传感器发送数据
void Stop() override
停止监听新的测量结果。
void DisableForROS()
禁用此传感器以进行 ROS2 发布
bool IsListening() const override
返回此传感器实例当前是否正在监听模拟器中的相关传感器。
void Listen(CallbackFunctionType callback) override
注册一个 回调,每次收到新的测量值时执行。
void StopGBuffer(uint32_t GBufferId)
停止监听特定的 gbuffer 流。
CARLA模拟器的主命名空间。
Definition Carla.cpp:139
包含CARLA客户端相关类和函数的命名空间。