CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
sensor
s11n
ObstacleDetectionEventSerializer.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/Buffer.h
"
10
#include "
carla/Debug.h
"
11
#include "
carla/Memory.h
"
12
#include "
carla/rpc/Actor.h
"
13
#include "
carla/sensor/RawData.h
"
14
15
namespace
carla
{
16
namespace
sensor
{
17
18
class
SensorData
;
19
20
namespace
s11n
{
21
22
/// Serializes the current state of the whole episode.
23
class
ObstacleDetectionEventSerializer
{
24
public
:
25
26
struct
Data
{
27
28
rpc::Actor
self_actor
;
29
30
rpc::Actor
other_actor
;
31
32
float
distance
;
33
34
MSGPACK_DEFINE_ARRAY(
self_actor
,
other_actor
,
distance
)
35
};
36
37
constexpr
static
auto
header_offset
= 0u;
38
39
static
Data
DeserializeRawData
(
const
RawData
&message) {
40
return
MsgPack::UnPack<Data>
(message.
begin
(), message.
size
());
41
}
42
43
template
<
typename
SensorT>
44
static
Buffer
Serialize
(
45
const
SensorT &,
46
rpc::Actor
self_actor,
47
rpc::Actor
other_actor,
48
float
distance) {
49
return
MsgPack::Pack
(
Data
{self_actor, other_actor, distance});
50
}
51
52
static
SharedPtr<SensorData>
Deserialize
(
RawData
&&
data
);
53
};
54
55
}
// namespace s11n
56
}
// namespace sensor
57
}
// namespace carla
Debug.h
Memory.h
RawData.h
Buffer.h
carla::Buffer
A piece of raw data.
Definition
carla/Buffer.h:42
carla::MsgPack::UnPack
static T UnPack(const Buffer &buffer)
Definition
MsgPack.h:27
carla::MsgPack::Pack
static Buffer Pack(const T &obj)
Definition
MsgPack.h:19
carla::rpc::Actor
Definition
rpc/Actor.h:20
carla::sensor::RawData
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition
RawData.h:21
carla::sensor::RawData::begin
auto begin() noexcept
Begin iterator to the data generated by the sensor.
Definition
RawData.h:52
carla::sensor::RawData::size
size_t size() const
Size in bytes of the data generated by the sensor.
Definition
RawData.h:83
carla::sensor::SensorData
Base class for all the objects containing data generated by a sensor.
Definition
SensorData.h:22
carla::sensor::s11n::ObstacleDetectionEventSerializer
Serializes the current state of the whole episode.
Definition
ObstacleDetectionEventSerializer.h:23
carla::sensor::s11n::ObstacleDetectionEventSerializer::Deserialize
static SharedPtr< SensorData > Deserialize(RawData &&data)
Definition
ObstacleDetectionEventSerializer.cpp:14
carla::sensor::s11n::ObstacleDetectionEventSerializer::header_offset
static constexpr auto header_offset
Definition
ObstacleDetectionEventSerializer.h:37
carla::sensor::s11n::ObstacleDetectionEventSerializer::Serialize
static Buffer Serialize(const SensorT &, rpc::Actor self_actor, rpc::Actor other_actor, float distance)
Definition
ObstacleDetectionEventSerializer.h:44
carla::sensor::s11n::ObstacleDetectionEventSerializer::DeserializeRawData
static Data DeserializeRawData(const RawData &message)
Definition
ObstacleDetectionEventSerializer.h:39
carla::sensor::data
Definition
ROS2.h:33
carla::sensor::s11n
Definition
ROS2.h:39
carla::sensor
Definition
client/detail/Client.h:58
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
carla::SharedPtr
std::shared_ptr< T > SharedPtr
Definition
Memory.h:15
Actor.h
carla::sensor::s11n::ObstacleDetectionEventSerializer::Data
Definition
ObstacleDetectionEventSerializer.h:26
carla::sensor::s11n::ObstacleDetectionEventSerializer::Data::distance
float distance
Definition
ObstacleDetectionEventSerializer.h:32
carla::sensor::s11n::ObstacleDetectionEventSerializer::Data::other_actor
rpc::Actor other_actor
Definition
ObstacleDetectionEventSerializer.h:30
carla::sensor::s11n::ObstacleDetectionEventSerializer::Data::self_actor
rpc::Actor self_actor
Definition
ObstacleDetectionEventSerializer.h:28
Generated by
1.18.0