CARLA
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
carla::ros2::ROS2 Class Reference

#include <ROS2.h>

+ Collaboration diagram for carla::ros2::ROS2:

Public Member Functions

void AddActorCallback (void *actor, std::string ros_name, ActorCallback callback)
 
void AddActorParentRosName (void *actor, void *parent)
 
void AddActorRosName (void *actor, std::string ros_name)
 
void Enable (bool enable)
 
void EnableStream (carla::streaming::detail::stream_id_type id)
 
std::string GetActorParentRosName (void *actor)
 
std::string GetActorRosName (void *actor)
 
bool IsEnabled ()
 
bool IsStreamEnabled (carla::streaming::detail::stream_id_type id)
 
void ProcessDataFromCamera (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, int W, int H, float Fov, const carla::SharedBufferView buffer, void *actor=nullptr)
 
void ProcessDataFromCollisionSensor (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, uint32_t other_actor, carla::geom::Vector3D impulse, void *actor)
 
void ProcessDataFromDVS (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, const carla::SharedBufferView buffer, int W, int H, float Fov, void *actor=nullptr)
 
void ProcessDataFromGNSS (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, const carla::geom::GeoLocation &data, void *actor=nullptr)
 
void ProcessDataFromIMU (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, carla::geom::Vector3D accelerometer, carla::geom::Vector3D gyroscope, float compass, void *actor=nullptr)
 
void ProcessDataFromLidar (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, carla::sensor::data::LidarData &data, void *actor=nullptr)
 
void ProcessDataFromObstacleDetection (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, AActor *first_actor, AActor *second_actor, float distance, void *actor=nullptr)
 
void ProcessDataFromRadar (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, const carla::sensor::data::RadarData &data, void *actor=nullptr)
 
void ProcessDataFromSemanticLidar (uint64_t sensor_type, carla::streaming::detail::stream_id_type stream_id, const carla::geom::Transform sensor_transform, carla::sensor::data::SemanticLidarData &data, void *actor=nullptr)
 
void RemoveActorCallback (void *actor)
 
void RemoveActorRosName (void *actor)
 
void ResetStreams ()
 
 ROS2 (const ROS2 &obj)=delete
 
void SetFrame (uint64_t frame)
 
void SetTimestamp (double timestamp)
 
void Shutdown ()
 
void UpdateActorRosName (void *actor, std::string ros_name)
 

Static Public Member Functions

static std::shared_ptr< ROS2GetInstance ()
 

Private Member Functions

std::pair< std::shared_ptr< CarlaPublisher >, std::shared_ptr< CarlaTransformPublisher > > GetOrCreateSensor (int type, carla::streaming::detail::stream_id_type id, void *actor)
 
 ROS2 ()
 

Private Attributes

std::unordered_map< void *, ActorCallback_actor_callbacks
 
std::unordered_map< void *, std::vector< void * > > _actor_parent_ros_name
 
std::unordered_map< void *, std::string > _actor_ros_name
 
std::shared_ptr< CarlaClockPublisher_clock_publisher
 
std::shared_ptr< CarlaEgoVehicleControlSubscriber_controller
 
bool _enabled { false }
 
uint64_t _frame { 0 }
 
uint32_t _nanoseconds { 0 }
 
std::unordered_set< carla::streaming::detail::stream_id_type_publish_stream
 
std::unordered_map< void *, std::shared_ptr< CarlaPublisher > > _publishers
 
int32_t _seconds { 0 }
 
std::unordered_map< void *, std::shared_ptr< CarlaTransformPublisher > > _transforms
 

Static Private Attributes

static std::shared_ptr< ROS2_instance
 

Detailed Description

Definition at line 45 of file ROS2.h.

Constructor & Destructor Documentation

◆ ROS2() [1/2]

carla::ros2::ROS2::ROS2 ( const ROS2 obj)
delete

◆ ROS2() [2/2]

carla::ros2::ROS2::ROS2 ( )
inlineprivate

Definition at line 148 of file ROS2.h.

Member Function Documentation

◆ AddActorCallback()

void carla::ros2::ROS2::AddActorCallback ( void *  actor,
std::string  ros_name,
ActorCallback  callback 
)

Definition at line 174 of file ROS2.cpp.

References _actor_callbacks, and _controller.

◆ AddActorParentRosName()

void carla::ros2::ROS2::AddActorParentRosName ( void *  actor,
void *  parent 
)

Definition at line 114 of file ROS2.cpp.

References _actor_parent_ros_name.

◆ AddActorRosName()

void carla::ros2::ROS2::AddActorRosName ( void *  actor,
std::string  ros_name 
)

Definition at line 110 of file ROS2.cpp.

References _actor_ros_name.

◆ Enable()

void carla::ros2::ROS2::Enable ( bool  enable)

Definition at line 73 of file ROS2.cpp.

References _clock_publisher, _enabled, and carla::log_info().

+ Here is the call graph for this function:

◆ EnableStream()

void carla::ros2::ROS2::EnableStream ( carla::streaming::detail::stream_id_type  id)
inline

Definition at line 77 of file ROS2.h.

◆ GetActorParentRosName()

std::string carla::ros2::ROS2::GetActorParentRosName ( void *  actor)

Definition at line 147 of file ROS2.cpp.

References _actor_parent_ros_name, and GetActorRosName().

Referenced by GetOrCreateSensor().

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

◆ GetActorRosName()

std::string carla::ros2::ROS2::GetActorRosName ( void *  actor)

Definition at line 138 of file ROS2.cpp.

References _actor_ros_name.

Referenced by GetActorParentRosName(), and GetOrCreateSensor().

+ Here is the caller graph for this function:

◆ GetInstance()

static std::shared_ptr<ROS2> carla::ros2::ROS2::GetInstance ( )
inlinestatic

◆ GetOrCreateSensor()

std::pair< std::shared_ptr< CarlaPublisher >, std::shared_ptr< CarlaTransformPublisher > > carla::ros2::ROS2::GetOrCreateSensor ( int  type,
carla::streaming::detail::stream_id_type  id,
void *  actor 
)
private

◆ IsEnabled()

bool carla::ros2::ROS2::IsEnabled ( )
inline

Definition at line 60 of file ROS2.h.

◆ IsStreamEnabled()

bool carla::ros2::ROS2::IsStreamEnabled ( carla::streaming::detail::stream_id_type  id)
inline

Definition at line 78 of file ROS2.h.

◆ ProcessDataFromCamera()

void carla::ros2::ROS2::ProcessDataFromCamera ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
int  W,
int  H,
float  Fov,
const carla::SharedBufferView  buffer,
void *  actor = nullptr 
)

◆ ProcessDataFromCollisionSensor()

void carla::ros2::ROS2::ProcessDataFromCollisionSensor ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
uint32_t  other_actor,
carla::geom::Vector3D  impulse,
void *  actor 
)

Definition at line 814 of file ROS2.cpp.

References _nanoseconds, _seconds, carla::ros2::CollisionSensor, GetOrCreateSensor(), carla::geom::Transform::location, carla::geom::Transform::rotation, carla::ros2::CarlaTransformPublisher::SetData(), carla::ros2::CarlaCollisionPublisher::SetData(), carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.

+ Here is the call graph for this function:

◆ ProcessDataFromDVS()

void carla::ros2::ROS2::ProcessDataFromDVS ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
const carla::SharedBufferView  buffer,
int  W,
int  H,
float  Fov,
void *  actor = nullptr 
)

Definition at line 705 of file ROS2.cpp.

References _frame, _nanoseconds, _seconds, carla::ros2::DVSCamera, GetOrCreateSensor(), carla::sensor::s11n::ImageSerializer::header_offset, carla::geom::Transform::location, carla::log_info(), carla::geom::Transform::rotation, and carla::ros2::CarlaTransformPublisher::SetData().

+ Here is the call graph for this function:

◆ ProcessDataFromGNSS()

void carla::ros2::ROS2::ProcessDataFromGNSS ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
const carla::geom::GeoLocation data,
void *  actor = nullptr 
)

◆ ProcessDataFromIMU()

void carla::ros2::ROS2::ProcessDataFromIMU ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
carla::geom::Vector3D  accelerometer,
carla::geom::Vector3D  gyroscope,
float  compass,
void *  actor = nullptr 
)

Definition at line 683 of file ROS2.cpp.

References _frame, _nanoseconds, _seconds, GetOrCreateSensor(), carla::ros2::InertialMeasurementUnit, carla::geom::Transform::location, carla::log_info(), carla::geom::Transform::rotation, carla::ros2::CarlaIMUPublisher::SetData(), carla::ros2::CarlaTransformPublisher::SetData(), and carla::geom::Vector3D::x.

+ Here is the call graph for this function:

◆ ProcessDataFromLidar()

void carla::ros2::ROS2::ProcessDataFromLidar ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
carla::sensor::data::LidarData data,
void *  actor = nullptr 
)

Definition at line 735 of file ROS2.cpp.

References _frame, _nanoseconds, carla::sensor::data::LidarData::_points, _seconds, GetOrCreateSensor(), carla::geom::Transform::location, carla::log_info(), carla::ros2::RayCastLidar, carla::geom::Transform::rotation, and carla::ros2::CarlaTransformPublisher::SetData().

+ Here is the call graph for this function:

◆ ProcessDataFromObstacleDetection()

void carla::ros2::ROS2::ProcessDataFromObstacleDetection ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
AActor first_actor,
AActor second_actor,
float  distance,
void *  actor = nullptr 
)

Definition at line 803 of file ROS2.cpp.

References _frame, and carla::log_info().

+ Here is the call graph for this function:

◆ ProcessDataFromRadar()

void carla::ros2::ROS2::ProcessDataFromRadar ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
const carla::sensor::data::RadarData data,
void *  actor = nullptr 
)

Definition at line 780 of file ROS2.cpp.

References carla::sensor::data::RadarData::_detections, _frame, _nanoseconds, _seconds, carla::sensor::data::RadarData::GetDetectionCount(), GetOrCreateSensor(), carla::geom::Transform::location, carla::log_info(), carla::ros2::Radar, carla::geom::Transform::rotation, and carla::ros2::CarlaTransformPublisher::SetData().

+ Here is the call graph for this function:

◆ ProcessDataFromSemanticLidar()

void carla::ros2::ROS2::ProcessDataFromSemanticLidar ( uint64_t  sensor_type,
carla::streaming::detail::stream_id_type  stream_id,
const carla::geom::Transform  sensor_transform,
carla::sensor::data::SemanticLidarData data,
void *  actor = nullptr 
)

Definition at line 757 of file ROS2.cpp.

References _frame, _nanoseconds, _seconds, carla::sensor::data::SemanticLidarData::_ser_points, GetOrCreateSensor(), carla::geom::Transform::location, carla::log_info(), carla::ros2::RayCastSemanticLidar, carla::geom::Transform::rotation, and carla::ros2::CarlaTransformPublisher::SetData().

+ Here is the call graph for this function:

◆ RemoveActorCallback()

void carla::ros2::ROS2::RemoveActorCallback ( void *  actor)

Definition at line 182 of file ROS2.cpp.

References _actor_callbacks, and _controller.

Referenced by SetFrame().

+ Here is the caller graph for this function:

◆ RemoveActorRosName()

void carla::ros2::ROS2::RemoveActorRosName ( void *  actor)

Definition at line 123 of file ROS2.cpp.

References _actor_parent_ros_name, _actor_ros_name, _publishers, and _transforms.

◆ ResetStreams()

void carla::ros2::ROS2::ResetStreams ( )
inline

Definition at line 79 of file ROS2.h.

◆ SetFrame()

void carla::ros2::ROS2::SetFrame ( uint64_t  frame)

Definition at line 80 of file ROS2.cpp.

References _actor_callbacks, _controller, _frame, and RemoveActorCallback().

+ Here is the call graph for this function:

◆ SetTimestamp()

void carla::ros2::ROS2::SetTimestamp ( double  timestamp)

Definition at line 99 of file ROS2.cpp.

References _clock_publisher, _nanoseconds, and _seconds.

◆ Shutdown()

void carla::ros2::ROS2::Shutdown ( )

Definition at line 834 of file ROS2.cpp.

References _clock_publisher, _controller, _enabled, _publishers, and _transforms.

◆ UpdateActorRosName()

void carla::ros2::ROS2::UpdateActorRosName ( void *  actor,
std::string  ros_name 
)

Definition at line 131 of file ROS2.cpp.

References _actor_ros_name.

Referenced by GetOrCreateSensor().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _actor_callbacks

std::unordered_map<void *, ActorCallback> carla::ros2::ROS2::_actor_callbacks
private

Definition at line 163 of file ROS2.h.

Referenced by AddActorCallback(), RemoveActorCallback(), and SetFrame().

◆ _actor_parent_ros_name

std::unordered_map<void *, std::vector<void*> > carla::ros2::ROS2::_actor_parent_ros_name
private

Definition at line 157 of file ROS2.h.

Referenced by AddActorParentRosName(), GetActorParentRosName(), and RemoveActorRosName().

◆ _actor_ros_name

std::unordered_map<void *, std::string> carla::ros2::ROS2::_actor_ros_name
private

Definition at line 156 of file ROS2.h.

Referenced by AddActorRosName(), GetActorRosName(), RemoveActorRosName(), and UpdateActorRosName().

◆ _clock_publisher

std::shared_ptr<CarlaClockPublisher> carla::ros2::ROS2::_clock_publisher
private

Definition at line 159 of file ROS2.h.

Referenced by Enable(), SetTimestamp(), and Shutdown().

◆ _controller

std::shared_ptr<CarlaEgoVehicleControlSubscriber> carla::ros2::ROS2::_controller
private

Definition at line 158 of file ROS2.h.

Referenced by AddActorCallback(), RemoveActorCallback(), SetFrame(), and Shutdown().

◆ _enabled

bool carla::ros2::ROS2::_enabled { false }
private

Definition at line 152 of file ROS2.h.

Referenced by Enable(), and Shutdown().

◆ _frame

uint64_t carla::ros2::ROS2::_frame { 0 }
private

◆ _instance

std::shared_ptr< ROS2 > carla::ros2::ROS2::_instance
staticprivate

Definition at line 148 of file ROS2.h.

◆ _nanoseconds

uint32_t carla::ros2::ROS2::_nanoseconds { 0 }
private

◆ _publish_stream

std::unordered_set<carla::streaming::detail::stream_id_type> carla::ros2::ROS2::_publish_stream
private

Definition at line 162 of file ROS2.h.

◆ _publishers

std::unordered_map<void *, std::shared_ptr<CarlaPublisher> > carla::ros2::ROS2::_publishers
private

Definition at line 160 of file ROS2.h.

Referenced by GetOrCreateSensor(), RemoveActorRosName(), and Shutdown().

◆ _seconds

int32_t carla::ros2::ROS2::_seconds { 0 }
private

◆ _transforms

std::unordered_map<void *, std::shared_ptr<CarlaTransformPublisher> > carla::ros2::ROS2::_transforms
private

Definition at line 161 of file ROS2.h.

Referenced by GetOrCreateSensor(), RemoveActorRosName(), and Shutdown().


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