#include <ROS2.h>
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< ROS2 > | GetInstance () |
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 |
|
delete |
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.
void carla::ros2::ROS2::AddActorParentRosName | ( | void * | actor, |
void * | parent | ||
) |
Definition at line 114 of file ROS2.cpp.
References _actor_parent_ros_name.
void carla::ros2::ROS2::AddActorRosName | ( | void * | actor, |
std::string | ros_name | ||
) |
Definition at line 110 of file ROS2.cpp.
References _actor_ros_name.
void carla::ros2::ROS2::Enable | ( | bool | enable | ) |
Definition at line 73 of file ROS2.cpp.
References _clock_publisher, _enabled, and carla::log_info().
|
inline |
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().
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().
|
inlinestatic |
Definition at line 51 of file ROS2.h.
Referenced by FCarlaServer::FPimpl::BindActions(), FCarlaEngine::NotifyInitGame(), UActorDispatcher::OnActorDestroyed(), ACollisionSensor::OnCollisionEvent(), AObstacleDetectionSensor::OnObstacleDetectionEvent(), AGnssSensor::PostPhysTick(), AInertialMeasurementUnit::PostPhysTick(), ARayCastLidar::PostPhysTick(), ARayCastSemanticLidar::PostPhysTick(), ARadar::PostPhysTick(), ADVSCamera::PostPhysTick(), UActorDispatcher::RegisterActor(), FCarlaEngine::ResetFrameCounter(), FPixelReader::SendPixelsInRenderThread(), UCarlaEpisode::TickTimers(), FCarlaEngine::UpdateFrameCounter(), and FCarlaEngine::~FCarlaEngine().
|
private |
Definition at line 187 of file ROS2.cpp.
References _publishers, _transforms, carla::ros2::CameraGBufferFloat, carla::ros2::CameraGBufferUint8, carla::ros2::CollisionSensor, carla::ros2::DepthCamera, carla::ros2::DVSCamera, GetActorParentRosName(), GetActorRosName(), carla::ros2::GnssSensor, carla::ros2::InertialMeasurementUnit, carla::ros2::InstanceSegmentationCamera, carla::ros2::LaneInvasionSensor, carla::ros2::NormalsCamera, carla::ros2::ObstacleDetectionSensor, carla::ros2::OpticalFlowCamera, carla::ros2::Radar, carla::ros2::RayCastLidar, carla::ros2::RayCastSemanticLidar, carla::ros2::RssSensor, carla::ros2::SceneCaptureCamera, carla::ros2::SemanticSegmentationCamera, UpdateActorRosName(), and carla::ros2::WorldObserver.
Referenced by ProcessDataFromCamera(), ProcessDataFromCollisionSensor(), ProcessDataFromDVS(), ProcessDataFromGNSS(), ProcessDataFromIMU(), ProcessDataFromLidar(), ProcessDataFromRadar(), and ProcessDataFromSemanticLidar().
|
inline |
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 |
||
) |
Definition at line 478 of file ROS2.cpp.
References _frame, _nanoseconds, _seconds, carla::ros2::CameraGBufferFloat, carla::ros2::CameraGBufferUint8, carla::ros2::CollisionSensor, carla::ros2::DepthCamera, GetOrCreateSensor(), carla::sensor::s11n::OpticalFlowImageSerializer::header_offset, carla::sensor::s11n::ImageSerializer::header_offset, carla::ros2::InstanceSegmentationCamera, carla::ros2::LaneInvasionSensor, carla::geom::Transform::location, carla::log_info(), carla::ros2::NormalsCamera, carla::ros2::OpticalFlowCamera, carla::geom::Transform::rotation, carla::ros2::RssSensor, carla::ros2::SceneCaptureCamera, carla::ros2::SemanticSegmentationCamera, carla::ros2::CarlaLineInvasionPublisher::SetData(), carla::ros2::CarlaTransformPublisher::SetData(), and carla::ros2::WorldObserver.
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.
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().
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 |
||
) |
Definition at line 663 of file ROS2.cpp.
References _frame, _nanoseconds, _seconds, carla::geom::GeoLocation::altitude, GetOrCreateSensor(), carla::ros2::GnssSensor, carla::geom::GeoLocation::latitude, carla::geom::Transform::location, carla::log_info(), carla::geom::GeoLocation::longitude, carla::geom::Transform::rotation, carla::ros2::CarlaGNSSPublisher::SetData(), and carla::ros2::CarlaTransformPublisher::SetData().
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.
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().
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().
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().
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().
void carla::ros2::ROS2::RemoveActorCallback | ( | void * | actor | ) |
Definition at line 182 of file ROS2.cpp.
References _actor_callbacks, and _controller.
Referenced by SetFrame().
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.
void carla::ros2::ROS2::SetFrame | ( | uint64_t | frame | ) |
Definition at line 80 of file ROS2.cpp.
References _actor_callbacks, _controller, _frame, and RemoveActorCallback().
void carla::ros2::ROS2::SetTimestamp | ( | double | timestamp | ) |
Definition at line 99 of file ROS2.cpp.
References _clock_publisher, _nanoseconds, and _seconds.
void carla::ros2::ROS2::Shutdown | ( | ) |
Definition at line 834 of file ROS2.cpp.
References _clock_publisher, _controller, _enabled, _publishers, and _transforms.
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().
|
private |
Definition at line 163 of file ROS2.h.
Referenced by AddActorCallback(), RemoveActorCallback(), and SetFrame().
|
private |
Definition at line 157 of file ROS2.h.
Referenced by AddActorParentRosName(), GetActorParentRosName(), and RemoveActorRosName().
|
private |
Definition at line 156 of file ROS2.h.
Referenced by AddActorRosName(), GetActorRosName(), RemoveActorRosName(), and UpdateActorRosName().
|
private |
Definition at line 159 of file ROS2.h.
Referenced by Enable(), SetTimestamp(), and Shutdown().
|
private |
Definition at line 158 of file ROS2.h.
Referenced by AddActorCallback(), RemoveActorCallback(), SetFrame(), and Shutdown().
|
private |
Definition at line 152 of file ROS2.h.
Referenced by Enable(), and Shutdown().
|
private |
Definition at line 153 of file ROS2.h.
Referenced by ProcessDataFromCamera(), ProcessDataFromDVS(), ProcessDataFromGNSS(), ProcessDataFromIMU(), ProcessDataFromLidar(), ProcessDataFromObstacleDetection(), ProcessDataFromRadar(), ProcessDataFromSemanticLidar(), and SetFrame().
|
staticprivate |
|
private |
Definition at line 155 of file ROS2.h.
Referenced by ProcessDataFromCamera(), ProcessDataFromCollisionSensor(), ProcessDataFromDVS(), ProcessDataFromGNSS(), ProcessDataFromIMU(), ProcessDataFromLidar(), ProcessDataFromRadar(), ProcessDataFromSemanticLidar(), and SetTimestamp().
|
private |
|
private |
Definition at line 160 of file ROS2.h.
Referenced by GetOrCreateSensor(), RemoveActorRosName(), and Shutdown().
|
private |
Definition at line 154 of file ROS2.h.
Referenced by ProcessDataFromCamera(), ProcessDataFromCollisionSensor(), ProcessDataFromDVS(), ProcessDataFromGNSS(), ProcessDataFromIMU(), ProcessDataFromLidar(), ProcessDataFromRadar(), ProcessDataFromSemanticLidar(), and SetTimestamp().
|
private |
Definition at line 161 of file ROS2.h.
Referenced by GetOrCreateSensor(), RemoveActorRosName(), and Shutdown().