CARLA
Loading...
Searching...
No Matches
carla::client::ServerSideSensor Class Referencefinal

#include <ServerSideSensor.h>

Inheritance diagram for carla::client::ServerSideSensor:

Public Member Functions

bool Destroy () override
void DisableForROS ()
 Disable this sensor for ROS2 publishing.
void EnableForROS ()
 Enable this sensor for ROS2 publishing.
bool IsEnabledForROS ()
 Return if the sensor is publishing for ROS2.
bool IsListening () const override
 Return whether this Sensor instance is currently listening to the associated sensor in the simulator.
bool IsListeningGBuffer (uint32_t id) const
void Listen (CallbackFunctionType callback) override
 Register a callback to be executed each time a new measurement is received.
void ListenToGBuffer (uint32_t GBufferId, CallbackFunctionType callback)
 Listen fr.
void Send (const rpc::CustomV2XBytes &data)
 Send a binary message through this sensor.
void Stop () override
 Stop listening for new measurements.
void StopGBuffer (uint32_t GBufferId)
 Stop listening for a specific gbuffer stream.
 ~ServerSideSensor ()
Public Member Functions inherited from carla::client::Sensor
 Actor (ActorInitializer init)
Public Member Functions inherited from carla::client::Actor
 Actor (ActorInitializer init)
void AddAngularImpulse (const geom::Vector3D &vector)
 Add angular impulse to the actor.
void AddForce (const geom::Vector3D &force)
 Add force to the actor at its center of mass.
void AddForce (const geom::Vector3D &force, const geom::Vector3D &location)
 Add force to the actor at certain location.
void AddImpulse (const geom::Vector3D &impulse, const geom::Vector3D &location)
 Add impulse to the actor at certain location.
void AddImpulse (const geom::Vector3D &vector)
 Add impulse to the actor at its center of mass.
void AddTorque (const geom::Vector3D &vector)
 Add a torque to the actor.
void ApplyTexture (const rpc::MaterialParameter &MaterialParameter, const rpc::TextureColor &Texture)
void ApplyTexture (const rpc::MaterialParameter &MaterialParameter, const rpc::TextureFloatColor &Texture)
void DisableConstantAcceleration ()
 Disable the constant acceleration mode.
void DisableConstantVelocity ()
 Disable the constant velocity mode.
void EnableConstantAcceleration (const geom::Vector3D &vector)
 Enable a constant acceleration mode (direct acceleration, no pedal input).
void EnableConstantVelocity (const geom::Vector3D &vector)
 Enable a constant velocity mode.
geom::Vector3D GetAcceleration () const
 Return the current 3D acceleration of the actor.
std::string GetActorClassName () const
 Return the name of the underlying actor's Unreal class.
std::string GetActorName () const
 Return the name of the underlying Unreal actor.
rpc::ActorState GetActorState () const
geom::Vector3D GetAngularVelocity () const
 Return the current 3D angular velocity of the actor.
std::vector< std::string > GetBoneNames () const
 Return the names of every bone reachable from the actor's first skinned mesh component.
std::vector< geom::Transform > GetBoneRelativeTransforms () const
 Return the component-space transforms of every bone reachable from the actor's skinned mesh components.
std::vector< geom::Transform > GetBoneWorldTransforms () const
 Return the world-space transforms of every bone reachable from the actor's skinned mesh components.
std::vector< std::string > GetComponentNames () const
 Return the names of every actor component attached to the actor.
geom::Transform GetComponentRelativeTransform (const std::string &component_name) const
 Return the parent-relative transform of the scene component named component_name attached to the actor.
geom::Transform GetComponentWorldTransform (const std::string &component_name) const
 Return the world-space transform of the scene component named component_name attached to the actor.
geom::Location GetLocation () const
 Return the current location of the actor.
std::vector< std::string > GetSocketNames () const
 Return the names of every socket on every scene component attached to the actor.
std::vector< geom::Transform > GetSocketRelativeTransforms () const
 Return the actor-relative transforms of every socket on every scene component attached to the actor.
std::vector< geom::Transform > GetSocketWorldTransforms () const
 Return the world-space transforms of every socket on every scene component attached to the actor.
geom::Transform GetTransform () const
 Return the current transform of the actor.
geom::Vector3D GetVelocity () const
 Return the current 3D velocity of the actor.
bool IsActive () const
bool IsAlive () const
bool IsDormant () const
const auto & Serialize () const
void SetActorDead ()
 Set actor as dead and starts his life span.
void SetCollisions (bool enabled=true)
 Enable or disable collisions on this actor.
void SetEnableGravity (bool enabled=true)
 Enable or disable gravity on this actor.
void SetLocation (const geom::Location &location)
 Teleport the actor to location.
void SetSimulatePhysics (bool enabled=true)
 Enable or disable physics simulation on this actor.
void SetTargetAngularVelocity (const geom::Vector3D &vector)
 Set the angular velocity of the actor before applying physics.
void SetTargetVelocity (const geom::Vector3D &vector)
 Set the actor velocity before applying physics.
void SetTransform (const geom::Transform &transform)
 Teleport and rotate the actor to transform.
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< Actor > GetParent () const
ActorId GetParentId () const
const std::vector< uint8_t > & GetSemanticTags () const
uint64_t GetSpawnFrame () const
 Frame of the last world snapshot this client had received when the spawn of this actor was acknowledged by the server; unset for looked-up handles.
const std::string & GetTypeId () const
World GetWorld () const
bool WasSpawnedByThisClient () const
 Whether this handle was returned by a spawn call of this client, as opposed to being looked up (get_actor, get_actors, parent, spectator).

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::Actor & GetActorDescription () const
const geom::BoundingBox & GetBoundingBox () const
EpisodeProxy & GetEpisode ()
const EpisodeProxy & GetEpisode () const

Detailed Description

Definition at line 17 of file ServerSideSensor.h.

Constructor & Destructor Documentation

◆ ~ServerSideSensor()

Member Function Documentation

◆ Destroy()

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

Additionally stop listening.

Reimplemented from carla::client::Actor.

Definition at line 105 of file ServerSideSensor.cpp.

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

◆ 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().

◆ 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().

◆ 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().

◆ 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 38 of file ServerSideSensor.h.

References listening_mask.

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

◆ IsListeningGBuffer()

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

Definition at line 48 of file ServerSideSensor.h.

References listening_mask.

◆ 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, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ ListenToGBuffer()

◆ Send()

void carla::client::ServerSideSensor::Send ( const rpc::CustomV2XBytes & data)

◆ Stop()

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

◆ StopGBuffer()

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: