CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
sensor
data
ObstacleDetectionEvent.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/Debug.h
"
10
#include "
carla/client/detail/ActorVariant.h
"
11
#include "
carla/sensor/SensorData.h
"
12
#include "
carla/sensor/s11n/ObstacleDetectionEventSerializer.h
"
13
14
15
namespace
carla
{
16
namespace
sensor
{
17
namespace
data
{
18
19
/// A registered detection.
20
class
ObstacleDetectionEvent
:
public
SensorData
{
21
using
Super
=
SensorData
;
22
protected
:
23
24
using
Serializer
=
s11n::ObstacleDetectionEventSerializer
;
25
26
friend
Serializer
;
27
28
explicit
ObstacleDetectionEvent
(
const
RawData
&
data
)
29
:
Super
(
data
),
30
_self_actor
(nullptr),
31
_other_actor
(nullptr) {
32
auto
ddata =
Serializer::DeserializeRawData
(
data
);
33
_self_actor
= std::move(ddata.self_actor);
34
_other_actor
= std::move(ddata.other_actor);
35
_distance
= ddata.distance;
36
}
37
38
public
:
39
40
/// Get "self" actor. Actor that measured the collision.
41
SharedPtr<client::Actor>
GetActor
()
const
{
42
return
_self_actor
.
Get
(
GetEpisode
());
43
}
44
45
/// Get the actor to which we collided.
46
SharedPtr<client::Actor>
GetOtherActor
()
const
{
47
return
_other_actor
.
Get
(
GetEpisode
());
48
}
49
50
/// Get obstacle distance.
51
float
GetDistance
()
const
{
52
return
_distance
;
53
}
54
55
private
:
56
57
client::detail::ActorVariant
_self_actor
;
58
59
client::detail::ActorVariant
_other_actor
;
60
61
float
_distance
;
62
};
63
64
}
// namespace data
65
}
// namespace sensor
66
}
// namespace carla
ActorVariant.h
Debug.h
ObstacleDetectionEventSerializer.h
SensorData.h
carla::client::detail::ActorVariant
Holds an Actor, but only instantiates it when needed.
Definition
ActorVariant.h:30
carla::client::detail::ActorVariant::Get
SharedPtr< client::Actor > Get(EpisodeProxy episode) const
Definition
ActorVariant.h:49
carla::sensor::RawData
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition
RawData.h:21
carla::sensor::SensorData::GetEpisode
const auto & GetEpisode() const
Definition
SensorData.h:54
carla::sensor::SensorData::SensorData
SensorData(size_t frame, double timestamp, const rpc::Transform &sensor_transform)
Definition
SensorData.h:25
carla::sensor::data::ObstacleDetectionEvent::Serializer
s11n::ObstacleDetectionEventSerializer Serializer
Definition
ObstacleDetectionEvent.h:24
carla::sensor::data::ObstacleDetectionEvent::GetActor
SharedPtr< client::Actor > GetActor() const
Get "self" actor. Actor that measured the collision.
Definition
ObstacleDetectionEvent.h:41
carla::sensor::data::ObstacleDetectionEvent::Super
SensorData Super
Definition
ObstacleDetectionEvent.h:21
carla::sensor::data::ObstacleDetectionEvent::GetOtherActor
SharedPtr< client::Actor > GetOtherActor() const
Get the actor to which we collided.
Definition
ObstacleDetectionEvent.h:46
carla::sensor::data::ObstacleDetectionEvent::_self_actor
client::detail::ActorVariant _self_actor
Definition
ObstacleDetectionEvent.h:57
carla::sensor::data::ObstacleDetectionEvent::GetDistance
float GetDistance() const
Get obstacle distance.
Definition
ObstacleDetectionEvent.h:51
carla::sensor::data::ObstacleDetectionEvent::_distance
float _distance
Definition
ObstacleDetectionEvent.h:61
carla::sensor::data::ObstacleDetectionEvent::_other_actor
client::detail::ActorVariant _other_actor
Definition
ObstacleDetectionEvent.h:59
carla::sensor::data::ObstacleDetectionEvent::ObstacleDetectionEvent
ObstacleDetectionEvent(const RawData &data)
Definition
ObstacleDetectionEvent.h:28
carla::sensor::s11n::ObstacleDetectionEventSerializer
Serializes the current state of the whole episode.
Definition
ObstacleDetectionEventSerializer.h:23
carla::sensor::s11n::ObstacleDetectionEventSerializer::DeserializeRawData
static Data DeserializeRawData(const RawData &message)
Definition
ObstacleDetectionEventSerializer.h:39
carla::sensor::data
Definition
ROS2.h:33
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
Generated by
1.18.0