CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
client
ServerSideSensor.h
Go to the documentation of this file.
1
// Copyright (c) 2026 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/client/Sensor.h
"
10
#include "
carla/rpc/CustomV2XBytes.h
"
11
12
#include <bitset>
13
14
namespace
carla
{
15
namespace
client
{
16
17
class
ServerSideSensor
final :
public
Sensor
{
18
public
:
19
20
using
Sensor::Sensor;
21
22
~ServerSideSensor
();
23
24
/// Register a @a callback to be executed each time a new measurement is
25
/// received.
26
///
27
/// @warning Calling this function on a sensor that is already listening
28
/// steals the data stream from the previously set callback. Note that
29
/// several instances of Sensor (even in different processes) may point to
30
/// the same sensor in the simulator.
31
void
Listen
(
CallbackFunctionType
callback)
override
;
32
33
/// Stop listening for new measurements.
34
void
Stop
()
override
;
35
36
/// Return whether this Sensor instance is currently listening to the
37
/// associated sensor in the simulator.
38
bool
IsListening
()
const override
{
39
return
listening_mask
.test(0);
40
}
41
42
/// Listen fr
43
void
ListenToGBuffer
(uint32_t GBufferId,
CallbackFunctionType
callback);
44
45
/// Stop listening for a specific gbuffer stream.
46
void
StopGBuffer
(uint32_t GBufferId);
47
48
inline
bool
IsListeningGBuffer
(uint32_t
id
)
const
{
49
return
listening_mask
.test(
id
+ 1);
50
}
51
52
/// Enable this sensor for ROS2 publishing
53
void
EnableForROS
();
54
55
/// Disable this sensor for ROS2 publishing
56
void
DisableForROS
();
57
58
/// Return if the sensor is publishing for ROS2
59
bool
IsEnabledForROS
();
60
61
/// Send a binary message through this sensor. Only supported on the custom
62
/// V2X sensor (sensor.other.v2x_custom).
63
void
Send
(
const
rpc::CustomV2XBytes
&data);
64
65
/// @copydoc Actor::Destroy()
66
///
67
/// Additionally stop listening.
68
bool
Destroy
()
override
;
69
70
private
:
71
72
std::bitset<16>
listening_mask
;
73
};
74
75
}
// namespace client
76
}
// namespace carla
CustomV2XBytes.h
Sensor.h
carla::client::Sensor
Definition
LibCarla/source/carla/client/Sensor.h:17
carla::client::Sensor::CallbackFunctionType
std::function< void(SharedPtr< sensor::SensorData >)> CallbackFunctionType
Definition
LibCarla/source/carla/client/Sensor.h:20
carla::client::ServerSideSensor
Definition
ServerSideSensor.h:17
carla::client::ServerSideSensor::IsEnabledForROS
bool IsEnabledForROS()
Return if the sensor is publishing for ROS2.
Definition
ServerSideSensor.cpp:91
carla::client::ServerSideSensor::IsListeningGBuffer
bool IsListeningGBuffer(uint32_t id) const
Definition
ServerSideSensor.h:48
carla::client::ServerSideSensor::Send
void Send(const rpc::CustomV2XBytes &data)
Send a binary message through this sensor.
Definition
ServerSideSensor.cpp:95
carla::client::ServerSideSensor::EnableForROS
void EnableForROS()
Enable this sensor for ROS2 publishing.
Definition
ServerSideSensor.cpp:83
carla::client::ServerSideSensor::listening_mask
std::bitset< 16 > listening_mask
Definition
ServerSideSensor.h:72
carla::client::ServerSideSensor::Destroy
bool Destroy() override
Definition
ServerSideSensor.cpp:105
carla::client::ServerSideSensor::ListenToGBuffer
void ListenToGBuffer(uint32_t GBufferId, CallbackFunctionType callback)
Listen fr.
Definition
ServerSideSensor.cpp:58
carla::client::ServerSideSensor::Stop
void Stop() override
Stop listening for new measurements.
Definition
ServerSideSensor.cpp:46
carla::client::ServerSideSensor::DisableForROS
void DisableForROS()
Disable this sensor for ROS2 publishing.
Definition
ServerSideSensor.cpp:87
carla::client::ServerSideSensor::IsListening
bool IsListening() const override
Return whether this Sensor instance is currently listening to the associated sensor in the simulator.
Definition
ServerSideSensor.h:38
carla::client::ServerSideSensor::Listen
void Listen(CallbackFunctionType callback) override
Register a callback to be executed each time a new measurement is received.
Definition
ServerSideSensor.cpp:39
carla::client::ServerSideSensor::StopGBuffer
void StopGBuffer(uint32_t GBufferId)
Stop listening for a specific gbuffer stream.
Definition
ServerSideSensor.cpp:71
carla::rpc::CustomV2XBytes
Fixed-size binary payload carried by the custom V2X sensor (sensor.other.v2x_custom).
Definition
CustomV2XBytes.h:19
carla::client
Definition
BasicAgent.h:24
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
Generated by
1.18.0