CARLA
Public Member Functions | Private Attributes | List of all members
carla::client::ServerSideSensor Class Referencefinal

#include <ServerSideSensor.h>

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

Public Member Functions

bool Destroy () override
 Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed. More...
 
void DisableForROS ()
 Disable this sensor for ROS2 publishing. More...
 
void EnableForROS ()
 Enable this sensor for ROS2 publishing. More...
 
bool IsEnabledForROS ()
 Return if the sensor is publishing for ROS2. More...
 
bool IsListening () const override
 Return whether this Sensor instance is currently listening to the associated sensor in the simulator. More...
 
bool IsListeningGBuffer (uint32_t id) const
 
void Listen (CallbackFunctionType callback) override
 Register a callback to be executed each time a new measurement is received. More...
 
void ListenToGBuffer (uint32_t GBufferId, CallbackFunctionType callback)
 Listen fr. More...
 
void Stop () override
 Stop listening for new measurements. More...
 
void StopGBuffer (uint32_t GBufferId)
 Stop listening for a specific gbuffer stream. More...
 
 ~ServerSideSensor ()
 
- 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...
 
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 Attributes

std::bitset< 16 > listening_mask
 

Additional Inherited Members

- Public Types inherited from carla::client::Sensor
using CallbackFunctionType = std::function< void(SharedPtr< sensor::SensorData >)>
 
- 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

Definition at line 15 of file ServerSideSensor.h.

Constructor & Destructor Documentation

◆ ~ServerSideSensor()

carla::client::ServerSideSensor::~ServerSideSensor ( )

Definition at line 19 of file ServerSideSensor.cpp.

References GBufferTextureCount, carla::client::detail::ActorState::GetDisplayId(), carla::client::detail::ActorState::GetEpisode(), carla::client::Actor::IsAlive(), IsListening(), IsValid(), listening_mask, carla::log_error(), carla::log_warning(), Stop(), and StopGBuffer().

+ Here is the call graph for this function:

Member Function Documentation

◆ Destroy()

bool carla::client::ServerSideSensor::Destroy ( )
overridevirtual

Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed.

Note
It has no effect if the Actor was already successfully destroyed.
Warning
This function blocks until the destruction operation is completed by the simulator.

Additionally stop listening.

Reimplemented from carla::client::Actor.

Definition at line 95 of file ServerSideSensor.cpp.

References carla::client::Actor::Destroy(), GBufferTextureCount, carla::client::detail::ActorState::GetDisplayId(), IsListening(), listening_mask, carla::log_debug(), Stop(), and StopGBuffer().

Referenced by IsListeningGBuffer().

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

◆ DisableForROS()

void carla::client::ServerSideSensor::DisableForROS ( )

Disable this sensor for ROS2 publishing.

Definition at line 87 of file ServerSideSensor.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by IsListeningGBuffer().

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

◆ EnableForROS()

void carla::client::ServerSideSensor::EnableForROS ( )

Enable this sensor for ROS2 publishing.

Definition at line 83 of file ServerSideSensor.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by IsListeningGBuffer().

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

◆ IsEnabledForROS()

bool carla::client::ServerSideSensor::IsEnabledForROS ( )

Return if the sensor is publishing for ROS2.

Definition at line 91 of file ServerSideSensor.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by IsListeningGBuffer().

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

◆ IsListening()

bool carla::client::ServerSideSensor::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 36 of file ServerSideSensor.h.

References listening_mask, ListenToGBuffer(), and StopGBuffer().

Referenced by Destroy(), Stop(), and ~ServerSideSensor().

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

◆ IsListeningGBuffer()

bool carla::client::ServerSideSensor::IsListeningGBuffer ( uint32_t  id) const
inline

Definition at line 46 of file ServerSideSensor.h.

References Destroy(), DisableForROS(), EnableForROS(), IsEnabledForROS(), and listening_mask.

+ Here is the call graph for this function:

◆ Listen()

void carla::client::ServerSideSensor::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 39 of file ServerSideSensor.cpp.

References carla::client::detail::ActorState::GetDisplayId(), carla::client::detail::ActorState::GetEpisode(), listening_mask, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), and carla::log_debug().

+ Here is the call graph for this function:

◆ ListenToGBuffer()

void carla::client::ServerSideSensor::ListenToGBuffer ( uint32_t  GBufferId,
CallbackFunctionType  callback 
)

Listen fr.

Definition at line 58 of file ServerSideSensor.cpp.

References GBufferTextureCount, carla::client::detail::ActorState::GetActorDescription(), carla::client::detail::ActorState::GetDisplayId(), carla::client::detail::ActorState::GetEpisode(), carla::rpc::Actor::id, listening_mask, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_debug(), carla::log_warning(), and RELEASE_ASSERT.

Referenced by IsListening().

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

◆ Stop()

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

Stop listening for new measurements.

Implements carla::client::Sensor.

Definition at line 46 of file ServerSideSensor.cpp.

References carla::client::detail::ActorState::GetDisplayId(), carla::client::detail::ActorState::GetEpisode(), IsListening(), listening_mask, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_debug(), and carla::log_warning().

Referenced by Destroy(), and ~ServerSideSensor().

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

◆ StopGBuffer()

void carla::client::ServerSideSensor::StopGBuffer ( uint32_t  GBufferId)

Stop listening for a specific gbuffer stream.

Definition at line 71 of file ServerSideSensor.cpp.

References GBufferTextureCount, carla::client::detail::ActorState::GetActorDescription(), carla::client::detail::ActorState::GetDisplayId(), carla::client::detail::ActorState::GetEpisode(), carla::rpc::Actor::id, listening_mask, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_debug(), carla::log_warning(), and RELEASE_ASSERT.

Referenced by Destroy(), IsListening(), and ~ServerSideSensor().

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

Member Data Documentation

◆ listening_mask

std::bitset<16> carla::client::ServerSideSensor::listening_mask
private

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