用于发布CARLA时钟信息的ROS 2发布者类。 更多...
#include <CarlaClockPublisher.h>
Public 成员函数 | |
CarlaClockPublisher (CarlaClockPublisher &&) | |
移动构造函数。 | |
CarlaClockPublisher (const CarlaClockPublisher &) | |
拷贝构造函数。 | |
CarlaClockPublisher (const char *ros_name="", const char *parent="") | |
构造函数,初始化CarlaClockPublisher。 | |
bool | Init () |
初始化发布者。 | |
CarlaClockPublisher & | operator= (CarlaClockPublisher &&) |
移动赋值运算符。 | |
CarlaClockPublisher & | operator= (const CarlaClockPublisher &) |
赋值运算符。 | |
bool | Publish () |
发布时钟信息。 | |
void | SetData (int32_t sec, uint32_t nanosec) |
设置要发布的时钟数据。 | |
const char * | type () const override |
重写基类中的type函数,返回此发布者的类型。 | |
~CarlaClockPublisher () | |
析构函数,清理资源并释放内部实现。 | |
![]() | |
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 属性 | |
std::shared_ptr< CarlaClockPublisherImpl > | _impl |
指向内部实现结构体的智能指针。 | |
额外继承的成员函数 | |
![]() | |
std::string | _frame_id = "" |
std::string | _name = "" |
std::string | _parent = "" |
用于发布CARLA时钟信息的ROS 2发布者类。
此类继承自CarlaPublisher,并专门用于发布时钟信息(如秒和纳秒)。
在文件 CarlaClockPublisher.h 第 29 行定义.
carla::ros2::CarlaClockPublisher::CarlaClockPublisher | ( | const char * | ros_name = "", |
const char * | parent = "" ) |
构造函数,初始化CarlaClockPublisher。
CarlaClockPublisher的构造函数
ros_name | ROS 2节点的名称,默认为空字符串。 |
parent | 父节点的名称,默认为空字符串。 |
初始化CarlaClockPublisher对象,包括设置名称、父对象,并创建实现类的实例。
ros_name | ROS节点名称 |
parent | 父对象名称 |
在文件 CarlaClockPublisher.cpp 第 238 行定义.
引用了 carla::ros2::CarlaPublisher::_name, carla::ros2::CarlaPublisher::_parent , 以及 carla::ros2::CarlaPublisher::parent().
carla::ros2::CarlaClockPublisher::~CarlaClockPublisher | ( | ) |
析构函数,清理资源并释放内部实现。
CarlaClockPublisher的析构函数
释放CarlaClockPublisher对象占用的资源,包括删除数据写入器、发布者、主题和参与者。
在文件 CarlaClockPublisher.cpp 第 248 行定义.
引用了 _impl.
carla::ros2::CarlaClockPublisher::CarlaClockPublisher | ( | const CarlaClockPublisher & | other | ) |
拷贝构造函数。
CarlaClockPublisher的拷贝构造函数
other | 要拷贝的CarlaClockPublisher对象。 |
创建一个新的CarlaClockPublisher对象,作为现有对象的副本。
other | 现有对象 |
在文件 CarlaClockPublisher.cpp 第 271 行定义.
引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.
carla::ros2::CarlaClockPublisher::CarlaClockPublisher | ( | CarlaClockPublisher && | other | ) |
移动构造函数。
CarlaClockPublisher的移动构造函数
other | 要移动的CarlaClockPublisher对象。 |
创建一个新的CarlaClockPublisher对象,通过移动现有对象的资源来初始化。
other | 现有对象 |
在文件 CarlaClockPublisher.cpp 第 300 行定义.
引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.
bool carla::ros2::CarlaClockPublisher::Init | ( | ) |
初始化发布者。
初始化CarlaClockPublisher对象。
此函数负责创建并配置DDS中的DomainParticipant、Publisher、Topic和DataWriter。
在文件 CarlaClockPublisher.cpp 第 85 行定义.
引用了 carla::ros2::CarlaPublisher::_frame_id, _impl , 以及 carla::ros2::CarlaPublisher::_name.
CarlaClockPublisher & carla::ros2::CarlaClockPublisher::operator= | ( | CarlaClockPublisher && | other | ) |
移动赋值运算符。
移动赋值运算符重载
other | 要移动赋值的CarlaClockPublisher对象。 |
通过移动现有对象的资源来更新当前对象。
other | 现有对象 |
在文件 CarlaClockPublisher.cpp 第 314 行定义.
引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.
CarlaClockPublisher & carla::ros2::CarlaClockPublisher::operator= | ( | const CarlaClockPublisher & | other | ) |
赋值运算符。
赋值运算符重载
other | 要赋值的CarlaClockPublisher对象。 |
将现有对象的值赋给当前对象。
other | 现有对象 |
在文件 CarlaClockPublisher.cpp 第 285 行定义.
引用了 carla::ros2::CarlaPublisher::_frame_id, _impl, carla::ros2::CarlaPublisher::_name , 以及 carla::ros2::CarlaPublisher::_parent.
bool carla::ros2::CarlaClockPublisher::Publish | ( | ) |
发布时钟信息。
发布时钟数据的方法
该方法尝试通过Fast-RTPS发布时钟数据。 如果发布成功,则返回true;否则,根据返回码输出相应的错误信息,并返回false。
在文件 CarlaClockPublisher.cpp 第 141 行定义.
引用了 _impl.
void carla::ros2::CarlaClockPublisher::SetData | ( | int32_t | sec, |
uint32_t | nanosec ) |
设置要发布的时钟数据。
设置时钟数据的方法
sec | 秒数。 |
nanosec | 纳秒数。 |
该方法用于设置时钟数据的秒和纳秒部分。
sec | 秒部分 |
nanosec | 纳秒部分 |
在文件 CarlaClockPublisher.cpp 第 226 行定义.
引用了 _impl.
|
inlineoverridevirtual |
重写基类中的type函数,返回此发布者的类型。
实现了 carla::ros2::CarlaPublisher.
在文件 CarlaClockPublisher.h 第 92 行定义.
|
private |
指向内部实现结构体的智能指针。
使用shared_ptr来管理CarlaClockPublisherImpl的生命周期,允许多个对象共享同一个实现。
在文件 CarlaClockPublisher.h 第 100 行定义.
被这些函数引用 CarlaClockPublisher(), CarlaClockPublisher(), Init(), operator=(), operator=(), Publish(), SetData() , 以及 ~CarlaClockPublisher().