CARLA
 
载入中...
搜索中...
未找到
Public 成员函数 | Private 成员函数 | Private 属性 | 所有成员列表
carla::ros2::CarlaLidarPublisher类 参考

#include <CarlaLidarPublisher.h>

+ 类 carla::ros2::CarlaLidarPublisher 继承关系图:
+ carla::ros2::CarlaLidarPublisher 的协作图:

Public 成员函数

 CarlaLidarPublisher (CarlaLidarPublisher &&)
 CarlaLidarPublisher 类的移动构造函数
 
 CarlaLidarPublisher (const CarlaLidarPublisher &)
 CarlaLidarPublisher 类的拷贝构造函数
 
 CarlaLidarPublisher (const char *ros_name="", const char *parent="")
 CarlaLidarPublisher 类的构造函数
 
bool Init ()
 初始化CarlaLidarPublisher。
 
CarlaLidarPublisheroperator= (CarlaLidarPublisher &&)
 移动赋值运算符重载
 
CarlaLidarPublisheroperator= (const CarlaLidarPublisher &)
 拷贝赋值运算符重载
 
bool Publish ()
 发布激光雷达数据
 
void SetData (int32_t seconds, uint32_t nanoseconds, size_t height, size_t width, float *data)
 设置激光雷达数据,处理并转换数据类型
 
const char * type () const override
 
 ~CarlaLidarPublisher ()
 CarlaLidarPublisher 类的析构函数
 
- Public 成员函数 继承自 carla::ros2::CarlaPublisher
 CarlaPublisher ()=default
 
const std::string & frame_id () const
 
void frame_id (std::string &&frame_id)
 
const std::string & name () const
 
void name (std::string &&name)
 
const std::string & parent () const
 
void parent (std::string &&parent)
 
virtual ~CarlaPublisher ()=default
 

Private 成员函数

void SetData (int32_t seconds, uint32_t nanoseconds, size_t height, size_t width, std::vector< uint8_t > &&data)
 设置激光雷达数据
 

Private 属性

std::shared_ptr< CarlaLidarPublisherImpl_impl
 

额外继承的成员函数

- Protected 属性 继承自 carla::ros2::CarlaPublisher
std::string _frame_id = ""
 
std::string _name = ""
 
std::string _parent = ""
 

详细描述

在文件 CarlaLidarPublisher.h24 行定义.

构造及析构函数说明

◆ CarlaLidarPublisher() [1/3]

carla::ros2::CarlaLidarPublisher::CarlaLidarPublisher ( const char * ros_name = "",
const char * parent = "" )

CarlaLidarPublisher 类的构造函数

初始化 CarlaLidarPublisher 实例,并创建 CarlaLidarPublisherImpl 实现类的共享指针

参数
ros_nameROS 节点名称
parent父节点的名称

< ROS 节点名称

< 父节点名称

在文件 CarlaLidarPublisher.cpp305 行定义.

引用了 carla::ros2::CarlaPublisher::_name, carla::ros2::CarlaPublisher::_parent , 以及 carla::ros2::CarlaPublisher::parent().

+ 函数调用图:

◆ ~CarlaLidarPublisher()

carla::ros2::CarlaLidarPublisher::~CarlaLidarPublisher ( )

CarlaLidarPublisher 类的析构函数

释放所有分配的资源,包括数据写入器、发布者、主题和参与者

< 删除数据写入器

< 删除发布者

< 删除主题

< 删除参与者

在文件 CarlaLidarPublisher.cpp315 行定义.

引用了 _impl.

◆ CarlaLidarPublisher() [2/3]

carla::ros2::CarlaLidarPublisher::CarlaLidarPublisher ( const CarlaLidarPublisher & other)

CarlaLidarPublisher 类的拷贝构造函数

使用另一个 CarlaLidarPublisher 实例初始化新实例

参数
other要拷贝的 CarlaLidarPublisher 实例

< 拷贝帧 ID

< 拷贝 ROS 节点名称

< 拷贝父节点名称

< 共享实现类的指针

在文件 CarlaLidarPublisher.cpp338 行定义.

引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.

◆ CarlaLidarPublisher() [3/3]

carla::ros2::CarlaLidarPublisher::CarlaLidarPublisher ( CarlaLidarPublisher && other)

CarlaLidarPublisher 类的移动构造函数

使用另一个 CarlaidarLPublisher 实例的值初始化新实例,并移动资源

参数
other要移动的 CarlaLidarPublisher 实例

< 移动帧 ID

< 移动 ROS 节点名称

< 移动父节点名称

< 移动实现类的指针

在文件 CarlaLidarPublisher.cpp367 行定义.

引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.

成员函数说明

◆ Init()

bool carla::ros2::CarlaLidarPublisher::Init ( )

初始化CarlaLidarPublisher。

该函数负责初始化DDS通信所需的资源,包括域参与者、发布者、主题和数据写入器。

返回
初始化成功返回true,否则返回false。

在文件 CarlaLidarPublisher.cpp80 行定义.

引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.

◆ operator=() [1/2]

CarlaLidarPublisher & carla::ros2::CarlaLidarPublisher::operator= ( CarlaLidarPublisher && other)

移动赋值运算符重载

使用另一个 CarlaLidarPublisher 实例的值更新当前实例,并移动资源

参数
other要赋值的 CarlaLidarPublisher 实例
返回
CarlaLidarPublisher& 引用当前实例

< 移动帧 ID

< 移动 ROS 节点名称

< 移动父节点名称

< 移动实现类的指针

在文件 CarlaLidarPublisher.cpp382 行定义.

引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.

◆ operator=() [2/2]

CarlaLidarPublisher & carla::ros2::CarlaLidarPublisher::operator= ( const CarlaLidarPublisher & other)

拷贝赋值运算符重载

使用另一个 CarlaLidarPublisher 实例的值更新当前实例

参数
other要赋值的 CarlaLidarPublisher 实例
返回
CarlaLidarPublisher& 引用当前实例

< 更新帧 ID

< 更新 ROS 节点名称

< 更新父节点名称

< 共享实现类的指针

在文件 CarlaLidarPublisher.cpp352 行定义.

引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.

◆ Publish()

bool carla::ros2::CarlaLidarPublisher::Publish ( )

发布激光雷达数据

该函数尝试通过DDS(数据分发服务)发布激光雷达数据。 根据返回码,函数会返回发布是否成功。

返回
发布成功返回true,否则返回false。

DDS实例句柄

写入数据并获取返回码

尝试将激光雷达数据写入DDS,并获取操作返回码。

根据返回码处理结果

操作成功,返回true

发生错误,打印错误信息并返回false

操作不支持,打印错误信息并返回false

参数错误,打印错误信息并返回false

前置条件未满足,打印错误信息并返回false

资源不足,打印错误信息并返回false

功能未启用,打印错误信息并返回false

策略不可变,打印错误信息并返回false

策略不一致,打印错误信息并返回false

对象已被删除,打印错误信息并返回false

操作超时,打印错误信息并返回false

无数据,打印错误信息并返回false

非法操作,打印错误信息并返回false

安全策略不允许,打印错误信息并返回false

未知错误,打印未知错误信息并返回false

在文件 CarlaLidarPublisher.cpp137 行定义.

引用了 _impl.

◆ SetData() [1/2]

void carla::ros2::CarlaLidarPublisher::SetData ( int32_t seconds,
uint32_t nanoseconds,
size_t height,
size_t width,
float * data )

设置激光雷达数据,处理并转换数据类型

该函数接收激光雷达的原始浮点数据,将其中的某些值取反,然后转换为字节向量, 并调用另一个重载的 SetData 函数来设置激光雷达数据。

参数
seconds时间戳的秒部分
nanoseconds时间戳的纳秒部分
height数据的高度(行数)
width数据的宽度(列数),假设每个点包含4个浮数值(x, y, z, intensity)
data指向浮点数据数组的指针

在文件 CarlaLidarPublisher.cpp231 行定义.

引用了 end() , 以及 SetData().

被这些函数引用 SetData().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ SetData() [2/2]

void carla::ros2::CarlaLidarPublisher::SetData ( int32_t seconds,
uint32_t nanoseconds,
size_t height,
size_t width,
std::vector< uint8_t > && data )
private

设置激光雷达数据

该函数接收时间戳、数据的高度和宽度,以及处理后的字节数据, 然后设置激光雷达消息的各个字段。

参数
seconds时间戳的秒部分
nanoseconds时间戳的纳秒部分
height数据的高度(行数)
width数据的宽度(每行点数),注意这里已经是处理后的宽度(原始宽度的1/4)
data包含处理后的激光雷达数据的字节向量,按点(x, y, z, intensity)组织

在文件 CarlaLidarPublisher.cpp256 行定义.

引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, sensor_msgs::msg::PointField::count(), sensor_msgs::msg::PointField::datatype(), sensor_msgs::msg::PointField::name(), builtin_interfaces::msg::Time::nanosec(), sensor_msgs::msg::PointField::offset(), sensor_msgs::msg::PointField__FLOAT32 , 以及 builtin_interfaces::msg::Time::sec().

+ 函数调用图:

◆ type()

const char * carla::ros2::CarlaLidarPublisher::type ( ) const
inlineoverridevirtual

实现了 carla::ros2::CarlaPublisher.

在文件 CarlaLidarPublisher.h46 行定义.

类成员变量说明

◆ _impl

std::shared_ptr<CarlaLidarPublisherImpl> carla::ros2::CarlaLidarPublisher::_impl
private

该类的文档由以下文件生成: