CARLA
载入中...
搜索中...
未找到
LibCarla
source
carla
rss
LibCarla/source/carla/rss/RssSensor.h
浏览该文件的文档.
1
// Copyright (c) 2019-2020 Intel Corporation
2
//
3
// This work is licensed under the terms of the MIT license.
4
// For a copy, see <https://opensource.org/licenses/MIT>.
5
6
#pragma once
7
8
#include <atomic>
9
#include <future>
10
#include <list>
11
#include <memory>
12
#include <mutex>
13
#include <vector>
14
#include "
carla/client/Sensor.h
"
15
16
namespace
ad
{
17
namespace
rss {
18
namespace
world {
19
20
/// forward declaration of the RssDynamics struct
21
struct
RssDynamics;
22
23
}
// namespace world
24
}
// namespace rss
25
}
// namespace ad
26
27
namespace
carla
{
28
29
namespace
rss {
30
31
/// forward declaration of the RoadBoundariesMode
32
enum class
RoadBoundariesMode
;
33
/// forward declaration of the RssCheck class
34
class
RssCheck;
35
/// forward declaration of the ActorContellationResult struct
36
struct
ActorConstellationResult;
37
/// forward declaration of the ActorContellationData struct
38
struct
ActorConstellationData;
39
}
// namespace rss
40
41
namespace
client {
42
43
/// The RSS Sensor class implementing the carla::client::Sensor interface
44
/// This class is a proxy to the RssCheck class
45
class
RssSensor
:
public
Sensor
{
46
public
:
47
using
Sensor::Sensor;
48
49
using
ActorConstellationCallbackFunctionType
=
50
std::function<
::carla::rss::ActorConstellationResult
(
carla::SharedPtr<::carla::rss::ActorConstellationData>
)>;
51
52
/// @brief constructor
53
explicit
RssSensor
(
ActorInitializer
init);
54
55
/// @brief destructor
56
~RssSensor
();
57
58
/// Register a @a callback to be executed for each actor within each measurement to be processed
59
/// to decide on the operation of the RSS sensor in respect to the ego vehicle to actor constellation
60
void
RegisterActorConstellationCallback
(
ActorConstellationCallbackFunctionType
callback);
61
62
/// Register a @a callback to be executed each time a new measurement is
63
/// received.
64
///
65
/// @warning Calling this function on a sensor that is already listening
66
/// steals the data stream from the previously set callback. Note that
67
/// several instances of Sensor (even in different processes) may point to
68
/// the same sensor in the simulator.
69
void
Listen
(
CallbackFunctionType
callback)
override
;
70
71
/// Stop listening for new measurements.
72
/// Be aware: GIL has to be unlocked to be able to wait for callbacks not active.
73
void
Stop
()
override
;
74
75
/// Return whether this Sensor instance is currently listening to the
76
/// associated sensor in the simulator.
77
bool
IsListening
()
const override
{
78
return
_on_tick_register_id
!= 0u;
79
}
80
81
/// @brief sets the current log level
82
void
SetLogLevel
(
const
uint8_t &log_level);
83
84
/// @brief sets the current map log level
85
void
SetMapLogLevel
(
const
uint8_t &map_log_level);
86
87
/// @returns the currently used dynamics of the ego vehicle (@see also
88
/// RssCheck::GetEgoVehicleDynamics())
89
const ::ad::rss::world::RssDynamics &
GetEgoVehicleDynamics
()
const
;
90
/// @brief sets the ego vehicle dynamics to be used by the ego vehicle (@see
91
/// also RssCheck::SetEgoVehicleDynamics())
92
void
SetEgoVehicleDynamics
(const ::ad::rss::world::RssDynamics &ego_dynamics);
93
94
/// @returns the currently used dynamics of other vehicles (@see also
95
/// RssCheck::GetOtherVehicleDynamics())
96
const ::ad::rss::world::RssDynamics &
GetOtherVehicleDynamics
()
const
;
97
/// @brief sets the ego vehicle dynamics to be used by other vehicles (@see
98
/// also RssCheck::SetOtherVehicleDynamics())
99
void
SetOtherVehicleDynamics
(const ::ad::rss::world::RssDynamics &other_vehicle_dynamics);
100
101
/// @returns the currently used dynamics of pedestrians (@see also
102
/// RssCheck::GetPedestrianDynamics())
103
const ::ad::rss::world::RssDynamics &
GetPedestrianDynamics
()
const
;
104
/// @brief sets the ego vehicle dynamics to be used by pedestrians (@see
105
/// also RssCheck::SetPedestrianDynamics())
106
void
SetPedestrianDynamics
(const ::ad::rss::world::RssDynamics &pedestrian_dynamics);
107
108
/// @returns the current mode for respecting the road boundaries (@see also
109
/// RssCheck::GetRoadBoundariesMode())
110
const ::carla::rss::RoadBoundariesMode &
GetRoadBoundariesMode
()
const
;
111
/// @brief sets the current mode for respecting the road boundaries (@see also
112
/// RssCheck::SetRoadBoundariesMode())
113
void
SetRoadBoundariesMode
(const ::carla::rss::RoadBoundariesMode &road_boundaries_mode);
114
115
/// @returns the current routing targets (@see also
116
/// RssCheck::GetRoutingTargets())
117
const
std::vector<::carla::geom::Transform>
GetRoutingTargets
()
const
;
118
/// @brief appends a routing target to the current routing target list (@see
119
/// also RssCheck::AppendRoutingTarget())
120
void
AppendRoutingTarget
(const ::carla::geom::Transform &routing_target);
121
/// @brief resets the current routing target (@see also
122
/// RssCheck::ResetRoutingTargets())
123
void
ResetRoutingTargets
();
124
125
/// @brief drop the current route (@see also RssCheck::DropRoute())
126
void
DropRoute
();
127
128
private
:
129
/// the acutal sensor tick callback function
130
void
TickRssSensor
(
const
client::Timestamp
×tamp,
CallbackFunctionType
callback);
131
void
TickRssSensorThreadLocked
(
const
client::Timestamp
×tamp,
SharedPtr<carla::client::ActorList>
actors,
132
CallbackFunctionType
callback);
133
134
//// the object actually performing the RSS processing
135
std::shared_ptr<::carla::rss::RssCheck>
_rss_check
;
136
137
/// the id got when registering for the on tick event
138
std::size_t
_on_tick_register_id
;
139
140
/// the mutex to protect the actual RSS processing and in case it takes too long to process ever frame
141
std::mutex
_processing_lock
;
142
143
/// the future for the async ticking thread
144
std::future<void>
_tick_future
;
145
146
/// some debug timings
147
std::list<double>
_rss_check_timings
;
148
149
//// the rss actor constellation callback function
150
ActorConstellationCallbackFunctionType
_rss_actor_constellation_callback
;
151
152
/// reqired to store DropRoute() requests until next sensor tick
153
bool
_drop_route
;
154
155
/// last processed frame
156
std::size_t
_last_processed_frame
;
157
158
static
std::atomic_uint
_global_map_initialization_counter_
;
159
};
160
161
}
// namespace client
162
}
// namespace carla
Sensor.h
carla::client::ActorInitializer
Used to initialize Actor classes.
Definition
client/detail/ActorState.h:93
carla::client::RssSensor
The RSS Sensor class implementing the carla::client::Sensor interface This class is a proxy to the Rs...
Definition
LibCarla/source/carla/rss/RssSensor.h:45
carla::client::RssSensor::_last_processed_frame
std::size_t _last_processed_frame
last processed frame
Definition
LibCarla/source/carla/rss/RssSensor.h:156
carla::client::RssSensor::_tick_future
std::future< void > _tick_future
the future for the async ticking thread
Definition
LibCarla/source/carla/rss/RssSensor.h:144
carla::client::RssSensor::ResetRoutingTargets
void ResetRoutingTargets()
resets the current routing target (
Definition
LibCarla/source/carla/rss/RssSensor.cpp:281
carla::client::RssSensor::_on_tick_register_id
std::size_t _on_tick_register_id
the id got when registering for the on tick event
Definition
LibCarla/source/carla/rss/RssSensor.h:138
carla::client::RssSensor::~RssSensor
~RssSensor()
destructor
Definition
LibCarla/source/carla/rss/RssSensor.cpp:29
carla::client::RssSensor::IsListening
bool IsListening() const override
Return whether this Sensor instance is currently listening to the associated sensor in the simulator.
Definition
LibCarla/source/carla/rss/RssSensor.h:77
carla::client::RssSensor::GetOtherVehicleDynamics
const ::ad::rss::world::RssDynamics & GetOtherVehicleDynamics() const
Definition
LibCarla/source/carla/rss/RssSensor.cpp:186
carla::client::RssSensor::SetLogLevel
void SetLogLevel(const uint8_t &log_level)
sets the current log level
Definition
LibCarla/source/carla/rss/RssSensor.cpp:135
carla::client::RssSensor::SetEgoVehicleDynamics
void SetEgoVehicleDynamics(const ::ad::rss::world::RssDynamics &ego_dynamics)
sets the ego vehicle dynamics to be used by the ego vehicle (
Definition
LibCarla/source/carla/rss/RssSensor.cpp:172
carla::client::RssSensor::_rss_check
std::shared_ptr<::carla::rss::RssCheck > _rss_check
Definition
LibCarla/source/carla/rss/RssSensor.h:135
carla::client::RssSensor::DropRoute
void DropRoute()
drop the current route (
Definition
LibCarla/source/carla/rss/RssSensor.cpp:290
carla::client::RssSensor::_global_map_initialization_counter_
static std::atomic_uint _global_map_initialization_counter_
Definition
LibCarla/source/carla/rss/RssSensor.h:158
carla::client::RssSensor::SetPedestrianDynamics
void SetPedestrianDynamics(const ::ad::rss::world::RssDynamics &pedestrian_dynamics)
sets the ego vehicle dynamics to be used by pedestrians (
Definition
LibCarla/source/carla/rss/RssSensor.cpp:230
carla::client::RssSensor::RegisterActorConstellationCallback
void RegisterActorConstellationCallback(ActorConstellationCallbackFunctionType callback)
Register a callback to be executed for each actor within each measurement to be processed to decide o...
Definition
LibCarla/source/carla/rss/RssSensor.cpp:36
carla::client::RssSensor::ActorConstellationCallbackFunctionType
std::function<::carla::rss::ActorConstellationResult(carla::SharedPtr<::carla::rss::ActorConstellationData >)> ActorConstellationCallbackFunctionType
Definition
LibCarla/source/carla/rss/RssSensor.h:49
carla::client::RssSensor::Stop
void Stop() override
Stop listening for new measurements.
Definition
LibCarla/source/carla/rss/RssSensor.cpp:105
carla::client::RssSensor::GetPedestrianDynamics
const ::ad::rss::world::RssDynamics & GetPedestrianDynamics() const
Definition
LibCarla/source/carla/rss/RssSensor.cpp:215
carla::client::RssSensor::TickRssSensor
void TickRssSensor(const client::Timestamp ×tamp, CallbackFunctionType callback)
the acutal sensor tick callback function
Definition
LibCarla/source/carla/rss/RssSensor.cpp:296
carla::client::RssSensor::SetOtherVehicleDynamics
void SetOtherVehicleDynamics(const ::ad::rss::world::RssDynamics &other_vehicle_dynamics)
sets the ego vehicle dynamics to be used by other vehicles (
Definition
LibCarla/source/carla/rss/RssSensor.cpp:201
carla::client::RssSensor::SetMapLogLevel
void SetMapLogLevel(const uint8_t &map_log_level)
sets the current map log level
Definition
LibCarla/source/carla/rss/RssSensor.cpp:146
carla::client::RssSensor::_rss_check_timings
std::list< double > _rss_check_timings
some debug timings
Definition
LibCarla/source/carla/rss/RssSensor.h:147
carla::client::RssSensor::GetEgoVehicleDynamics
const ::ad::rss::world::RssDynamics & GetEgoVehicleDynamics() const
Definition
LibCarla/source/carla/rss/RssSensor.cpp:157
carla::client::RssSensor::RssSensor
RssSensor(ActorInitializer init)
constructor
Definition
LibCarla/source/carla/rss/RssSensor.cpp:27
carla::client::RssSensor::AppendRoutingTarget
void AppendRoutingTarget(const ::carla::geom::Transform &routing_target)
appends a routing target to the current routing target list (
Definition
LibCarla/source/carla/rss/RssSensor.cpp:263
carla::client::RssSensor::_processing_lock
std::mutex _processing_lock
the mutex to protect the actual RSS processing and in case it takes too long to process ever frame
Definition
LibCarla/source/carla/rss/RssSensor.h:141
carla::client::RssSensor::SetRoadBoundariesMode
void SetRoadBoundariesMode(const ::carla::rss::RoadBoundariesMode &road_boundaries_mode)
sets the current mode for respecting the road boundaries (
Definition
LibCarla/source/carla/rss/RssSensor.cpp:254
carla::client::RssSensor::_rss_actor_constellation_callback
ActorConstellationCallbackFunctionType _rss_actor_constellation_callback
Definition
LibCarla/source/carla/rss/RssSensor.h:150
carla::client::RssSensor::GetRoadBoundariesMode
const ::carla::rss::RoadBoundariesMode & GetRoadBoundariesMode() const
Definition
LibCarla/source/carla/rss/RssSensor.cpp:244
carla::client::RssSensor::GetRoutingTargets
const std::vector<::carla::geom::Transform > GetRoutingTargets() const
Definition
LibCarla/source/carla/rss/RssSensor.cpp:272
carla::client::RssSensor::Listen
void Listen(CallbackFunctionType callback) override
Register a callback to be executed each time a new measurement is received.
Definition
LibCarla/source/carla/rss/RssSensor.cpp:46
carla::client::RssSensor::_drop_route
bool _drop_route
reqired to store DropRoute() requests until next sensor tick
Definition
LibCarla/source/carla/rss/RssSensor.h:153
carla::client::RssSensor::TickRssSensorThreadLocked
void TickRssSensorThreadLocked(const client::Timestamp ×tamp, SharedPtr< carla::client::ActorList > actors, CallbackFunctionType callback)
Definition
LibCarla/source/carla/rss/RssSensor.cpp:327
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::Timestamp
Definition
Timestamp.h:14
ad
Definition
RssRestrictor.h:11
carla::rss::RoadBoundariesMode
RoadBoundariesMode
struct defining the different supported handling of road boundaries
Definition
RssCheck.h:28
carla
This file contains definitions of common data structures used in traffic manager.
Definition
Carla.cpp:133
carla::SharedPtr
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition
Memory.h:20
carla::rss::ActorConstellationResult
Struct defining the configuration for RSS processing of a given actor
Definition
RssCheck.h:96
制作者
1.10.0