CARLA
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
carla::client::RssSensor Class Reference

The RSS Sensor class implementing the carla::client::Sensor interface This class is a proxy to the RssCheck class. More...

#include <RssSensor.h>

+ Inheritance diagram for carla::client::RssSensor:
+ Collaboration diagram for carla::client::RssSensor:

Public Types

using ActorConstellationCallbackFunctionType = std::function<::carla::rss::ActorConstellationResult(carla::SharedPtr<::carla::rss::ActorConstellationData >)>
 
- Public Types inherited from carla::client::Sensor
using CallbackFunctionType = std::function< void(SharedPtr< sensor::SensorData >)>
 

Public Member Functions

void AppendRoutingTarget (const ::carla::geom::Transform &routing_target)
 appends a routing target to the current routing target list ( More...
 
void DropRoute ()
 drop the current route ( More...
 
const ::ad::rss::world::RssDynamics & GetEgoVehicleDynamics () const
 
const ::ad::rss::world::RssDynamics & GetOtherVehicleDynamics () const
 
const ::ad::rss::world::RssDynamics & GetPedestrianDynamics () const
 
const ::carla::rss::RoadBoundariesModeGetRoadBoundariesMode () const
 
const std::vector<::carla::geom::TransformGetRoutingTargets () const
 
bool IsListening () const override
 Return whether this Sensor instance is currently listening to the associated sensor in the simulator. More...
 
void Listen (CallbackFunctionType callback) override
 Register a callback to be executed each time a new measurement is received. More...
 
void RegisterActorConstellationCallback (ActorConstellationCallbackFunctionType callback)
 Register a callback to be executed for each actor within each measurement to be processed to decide on the operation of the RSS sensor in respect to the ego vehicle to actor constellation. More...
 
void ResetRoutingTargets ()
 resets the current routing target ( More...
 
 RssSensor (ActorInitializer init)
 constructor More...
 
void SetEgoVehicleDynamics (const ::ad::rss::world::RssDynamics &ego_dynamics)
 sets the ego vehicle dynamics to be used by the ego vehicle ( More...
 
void SetLogLevel (const uint8_t &log_level)
 sets the current log level More...
 
void SetMapLogLevel (const uint8_t &map_log_level)
 sets the current map log level More...
 
void SetOtherVehicleDynamics (const ::ad::rss::world::RssDynamics &other_vehicle_dynamics)
 sets the ego vehicle dynamics to be used by other vehicles ( More...
 
void SetPedestrianDynamics (const ::ad::rss::world::RssDynamics &pedestrian_dynamics)
 sets the ego vehicle dynamics to be used by pedestrians ( More...
 
void SetRoadBoundariesMode (const ::carla::rss::RoadBoundariesMode &road_boundaries_mode)
 sets the current mode for respecting the road boundaries ( More...
 
void Stop () override
 Stop listening for new measurements. More...
 
 ~RssSensor ()
 destructor More...
 
- Public Member Functions inherited from carla::client::Actor
 Actor (ActorInitializer init)
 
void AddAngularImpulse (const geom::Vector3D &vector)
 Add angular impulse to the actor. More...
 
void AddForce (const geom::Vector3D &force)
 Add force to the actor at its center of mass. More...
 
void AddForce (const geom::Vector3D &force, const geom::Vector3D &location)
 Add force to the actor at certain location. More...
 
void AddImpulse (const geom::Vector3D &vector)
 Add impulse to the actor at its center of mass. More...
 
void AddImpulse (const geom::Vector3D &impulse, const geom::Vector3D &location)
 Add impulse to the actor at certain location. More...
 
void AddTorque (const geom::Vector3D &vector)
 Add a torque to the actor. More...
 
virtual bool Destroy ()
 Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed. More...
 
void DisableConstantVelocity ()
 Disable the constant velocity mode. More...
 
void EnableConstantVelocity (const geom::Vector3D &vector)
 Enable a constant velocity mode. More...
 
geom::Vector3D GetAcceleration () const
 Return the current 3D acceleration of the actor. More...
 
rpc::ActorState GetActorState () const
 
geom::Vector3D GetAngularVelocity () const
 Return the current 3D angular velocity of the actor. More...
 
geom::Location GetLocation () const
 Return the current location of the actor. More...
 
geom::Transform GetTransform () const
 Return the current transform of the actor. More...
 
geom::Vector3D GetVelocity () const
 Return the current 3D velocity of the actor. More...
 
bool IsActive () const
 
bool IsAlive () const
 
bool IsDormant () const
 
const auto & Serialize () const
 
void SetActorDead ()
 Set actor as dead and starts his life span. More...
 
void SetCollisions (bool enabled=true)
 Enable or disable collisions on this actor. More...
 
void SetEnableGravity (bool enabled=true)
 Enable or disable gravity on this actor. More...
 
void SetLocation (const geom::Location &location)
 Teleport the actor to location. More...
 
void SetSimulatePhysics (bool enabled=true)
 Enable or disable physics simulation on this actor. More...
 
void SetTargetAngularVelocity (const geom::Vector3D &vector)
 Set the angular velocity of the actor before applying physics. More...
 
void SetTargetVelocity (const geom::Vector3D &vector)
 Set the actor velocity before applying physics. More...
 
void SetTransform (const geom::Transform &transform)
 Teleport and rotate the actor to transform. More...
 
virtual ~Actor ()=default
 
- Public Member Functions inherited from carla::client::detail::ActorState
const std::vector< ActorAttributeValue > & GetAttributes () const
 
const std::string & GetDisplayId () const
 
ActorId GetId () const
 
SharedPtr< ActorGetParent () const
 
ActorId GetParentId () const
 
const std::vector< uint8_t > & GetSemanticTags () const
 
const std::string & GetTypeId () const
 
World GetWorld () const
 

Private Member Functions

void TickRssSensor (const client::Timestamp &timestamp, CallbackFunctionType callback)
 the acutal sensor tick callback function More...
 
void TickRssSensorThreadLocked (const client::Timestamp &timestamp, SharedPtr< carla::client::ActorList > actors, CallbackFunctionType callback)
 

Private Attributes

bool _drop_route
 reqired to store DropRoute() requests until next sensor tick More...
 
std::size_t _last_processed_frame
 last processed frame More...
 
std::size_t _on_tick_register_id
 the id got when registering for the on tick event More...
 
std::mutex _processing_lock
 the mutex to protect the actual RSS processing and in case it takes too long to process ever frame More...
 
ActorConstellationCallbackFunctionType _rss_actor_constellation_callback
 
std::shared_ptr<::carla::rss::RssCheck_rss_check
 
std::list< double > _rss_check_timings
 some debug timings More...
 
std::future< void > _tick_future
 the future for the async ticking thread More...
 

Static Private Attributes

static std::atomic_uint _global_map_initialization_counter_ {0u}
 

Additional Inherited Members

- Protected Member Functions inherited from carla::client::detail::ActorState
 ActorState (rpc::Actor description, EpisodeProxy episode)
 
const rpc::ActorGetActorDescription () const
 
const geom::BoundingBoxGetBoundingBox () const
 
EpisodeProxyGetEpisode ()
 
const EpisodeProxyGetEpisode () const
 

Detailed Description

The RSS Sensor class implementing the carla::client::Sensor interface This class is a proxy to the RssCheck class.

Definition at line 45 of file LibCarla/source/carla/rss/RssSensor.h.

Member Typedef Documentation

◆ ActorConstellationCallbackFunctionType

Definition at line 50 of file LibCarla/source/carla/rss/RssSensor.h.

Constructor & Destructor Documentation

◆ RssSensor()

carla::client::RssSensor::RssSensor ( ActorInitializer  init)
explicit

constructor

Definition at line 27 of file LibCarla/source/carla/rss/RssSensor.cpp.

◆ ~RssSensor()

carla::client::RssSensor::~RssSensor ( )

destructor

Definition at line 29 of file LibCarla/source/carla/rss/RssSensor.cpp.

References IsListening(), and Stop().

+ Here is the call graph for this function:

Member Function Documentation

◆ AppendRoutingTarget()

void carla::client::RssSensor::AppendRoutingTarget ( const ::carla::geom::Transform routing_target)

appends a routing target to the current routing target list (

See also
also RssCheck::AppendRoutingTarget())

Definition at line 263 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ DropRoute()

void carla::client::RssSensor::DropRoute ( )

drop the current route (

See also
also RssCheck::DropRoute())

Definition at line 290 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _drop_route.

◆ GetEgoVehicleDynamics()

const ::ad::rss::world::RssDynamics & carla::client::RssSensor::GetEgoVehicleDynamics ( ) const
Returns
the currently used dynamics of the ego vehicle (
See also
also RssCheck::GetEgoVehicleDynamics())

Definition at line 157 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_actor_constellation_callback, _rss_check, carla::rss::RssCheck::GetDefaultVehicleDynamics(), carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ GetOtherVehicleDynamics()

const ::ad::rss::world::RssDynamics & carla::client::RssSensor::GetOtherVehicleDynamics ( ) const
Returns
the currently used dynamics of other vehicles (
See also
also RssCheck::GetOtherVehicleDynamics())

Definition at line 186 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_actor_constellation_callback, _rss_check, carla::rss::RssCheck::GetDefaultVehicleDynamics(), carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ GetPedestrianDynamics()

const ::ad::rss::world::RssDynamics & carla::client::RssSensor::GetPedestrianDynamics ( ) const
Returns
the currently used dynamics of pedestrians (
See also
also RssCheck::GetPedestrianDynamics())

Definition at line 215 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_actor_constellation_callback, _rss_check, carla::rss::RssCheck::GetDefaultPedestrianDynamics(), carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ GetRoadBoundariesMode()

const ::carla::rss::RoadBoundariesMode & carla::client::RssSensor::GetRoadBoundariesMode ( ) const
Returns
the current mode for respecting the road boundaries (
See also
also RssCheck::GetRoadBoundariesMode())

Definition at line 244 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_check, carla::rss::RssCheck::GetDefaultRoadBoundariesMode(), carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ GetRoutingTargets()

const std::vector<::carla::geom::Transform > carla::client::RssSensor::GetRoutingTargets ( ) const
Returns
the current routing targets (
See also
also RssCheck::GetRoutingTargets())

Definition at line 272 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ IsListening()

bool carla::client::RssSensor::IsListening ( ) const
inlineoverridevirtual

Return whether this Sensor instance is currently listening to the associated sensor in the simulator.

Implements carla::client::Sensor.

Definition at line 77 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by Listen(), RegisterActorConstellationCallback(), Stop(), and ~RssSensor().

+ Here is the caller graph for this function:

◆ Listen()

void carla::client::RssSensor::Listen ( CallbackFunctionType  callback)
overridevirtual

Register a callback to be executed each time a new measurement is received.

Warning
Calling this function on a sensor that is already listening steals the data stream from the previously set callback. Note that several instances of Sensor (even in different processes) may point to the same sensor in the simulator.

Implements carla::client::Sensor.

Definition at line 46 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _global_map_initialization_counter_, _last_processed_frame, _on_tick_register_id, _rss_actor_constellation_callback, _rss_check, DEBUG_ASSERT, carla::client::detail::ActorState::GetDisplayId(), carla::client::detail::ActorState::GetEpisode(), carla::client::World::GetMap(), carla::client::detail::ActorState::GetParent(), carla::client::detail::ActorState::GetWorld(), IsListening(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_debug(), carla::log_error(), carla::throw_exception(), and TrafficLight.

+ Here is the call graph for this function:

◆ RegisterActorConstellationCallback()

void carla::client::RssSensor::RegisterActorConstellationCallback ( ActorConstellationCallbackFunctionType  callback)

Register a callback to be executed for each actor within each measurement to be processed to decide on the operation of the RSS sensor in respect to the ego vehicle to actor constellation.

Definition at line 36 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_actor_constellation_callback, carla::client::detail::ActorState::GetDisplayId(), IsListening(), and carla::log_error().

+ Here is the call graph for this function:

◆ ResetRoutingTargets()

void carla::client::RssSensor::ResetRoutingTargets ( )

resets the current routing target (

See also
also RssCheck::ResetRoutingTargets())

Definition at line 281 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ SetEgoVehicleDynamics()

void carla::client::RssSensor::SetEgoVehicleDynamics ( const ::ad::rss::world::RssDynamics &  ego_dynamics)

sets the ego vehicle dynamics to be used by the ego vehicle (

See also
also RssCheck::SetEgoVehicleDynamics())

Definition at line 172 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_actor_constellation_callback, _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ SetLogLevel()

void carla::client::RssSensor::SetLogLevel ( const uint8_t &  log_level)

sets the current log level

Definition at line 135 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ SetMapLogLevel()

void carla::client::RssSensor::SetMapLogLevel ( const uint8_t &  map_log_level)

sets the current map log level

Definition at line 146 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ SetOtherVehicleDynamics()

void carla::client::RssSensor::SetOtherVehicleDynamics ( const ::ad::rss::world::RssDynamics &  other_vehicle_dynamics)

sets the ego vehicle dynamics to be used by other vehicles (

See also
also RssCheck::SetOtherVehicleDynamics())

Definition at line 201 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_actor_constellation_callback, _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ SetPedestrianDynamics()

void carla::client::RssSensor::SetPedestrianDynamics ( const ::ad::rss::world::RssDynamics &  pedestrian_dynamics)

sets the ego vehicle dynamics to be used by pedestrians (

See also
also RssCheck::SetPedestrianDynamics())

Definition at line 230 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_actor_constellation_callback, _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ SetRoadBoundariesMode()

void carla::client::RssSensor::SetRoadBoundariesMode ( const ::carla::rss::RoadBoundariesMode road_boundaries_mode)

sets the current mode for respecting the road boundaries (

See also
also RssCheck::SetRoadBoundariesMode())

Definition at line 254 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _rss_check, carla::client::detail::ActorState::GetDisplayId(), and carla::log_error().

+ Here is the call graph for this function:

◆ Stop()

void carla::client::RssSensor::Stop ( void  )
overridevirtual

Stop listening for new measurements.

Be aware: GIL has to be unlocked to be able to wait for callbacks not active.

Implements carla::client::Sensor.

Definition at line 105 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _global_map_initialization_counter_, _on_tick_register_id, _processing_lock, _rss_check, carla::client::detail::ActorState::GetDisplayId(), carla::client::detail::ActorState::GetEpisode(), IsListening(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_debug(), and carla::log_error().

Referenced by ~RssSensor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TickRssSensor()

void carla::client::RssSensor::TickRssSensor ( const client::Timestamp timestamp,
CallbackFunctionType  callback 
)
private

the acutal sensor tick callback function

Definition at line 296 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _last_processed_frame, _processing_lock, _rss_check, _tick_future, carla::client::Timestamp::frame, carla::client::World::GetActors(), carla::client::World::GetSettings(), carla::client::detail::ActorState::GetWorld(), and TickRssSensorThreadLocked().

+ Here is the call graph for this function:

◆ TickRssSensorThreadLocked()

void carla::client::RssSensor::TickRssSensorThreadLocked ( const client::Timestamp timestamp,
SharedPtr< carla::client::ActorList actors,
CallbackFunctionType  callback 
)
private

Definition at line 327 of file LibCarla/source/carla/rss/RssSensor.cpp.

References _drop_route, _processing_lock, _rss_check, _rss_check_timings, carla::client::Timestamp::elapsed_seconds, carla::client::Timestamp::frame, carla::client::detail::ActorState::GetParent(), and carla::client::Actor::GetTransform().

Referenced by TickRssSensor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _drop_route

bool carla::client::RssSensor::_drop_route
private

reqired to store DropRoute() requests until next sensor tick

Definition at line 153 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by DropRoute(), and TickRssSensorThreadLocked().

◆ _global_map_initialization_counter_

std::atomic_uint carla::client::RssSensor::_global_map_initialization_counter_ {0u}
staticprivate

Definition at line 158 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by Listen(), and Stop().

◆ _last_processed_frame

std::size_t carla::client::RssSensor::_last_processed_frame
private

last processed frame

Definition at line 156 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by Listen(), and TickRssSensor().

◆ _on_tick_register_id

std::size_t carla::client::RssSensor::_on_tick_register_id
private

the id got when registering for the on tick event

Definition at line 138 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by Listen(), and Stop().

◆ _processing_lock

std::mutex carla::client::RssSensor::_processing_lock
private

the mutex to protect the actual RSS processing and in case it takes too long to process ever frame

Definition at line 141 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by Stop(), TickRssSensor(), and TickRssSensorThreadLocked().

◆ _rss_actor_constellation_callback

ActorConstellationCallbackFunctionType carla::client::RssSensor::_rss_actor_constellation_callback
private

◆ _rss_check

std::shared_ptr<::carla::rss::RssCheck> carla::client::RssSensor::_rss_check
private

◆ _rss_check_timings

std::list<double> carla::client::RssSensor::_rss_check_timings
private

some debug timings

Definition at line 147 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by TickRssSensorThreadLocked().

◆ _tick_future

std::future<void> carla::client::RssSensor::_tick_future
private

the future for the async ticking thread

Definition at line 144 of file LibCarla/source/carla/rss/RssSensor.h.

Referenced by TickRssSensor().


The documentation for this class was generated from the following files: