|
|
using | PublisherType = rclcpp::Publisher<MessageT> |
| | Provide various typedefs to resemble the rclcpp::Publisher type.
|
|
using | PublisherSharedPtr = typename rclcpp::Publisher<MessageT>::SharedPtr |
|
using | PublishedType = typename rclcpp::TypeAdapter<MessageT>::custom_type |
|
using | ROSMessageType = typename rclcpp::TypeAdapter<MessageT>::ros_message_type |
|
| template<typename NodeT> |
| | RealtimePublisher (NodeT &&node, const std::string &topic_name, const rclcpp::QoS &qos, const rclcpp::PublisherOptions &options=rclcpp::PublisherOptions()) |
| | Constructor for the realtime publisher that creates the publisher internally.
|
| | RealtimePublisher (PublisherSharedPtr publisher) |
| | Constructor for the realtime publisher.
|
|
| ~RealtimePublisher () |
| | Destructor.
|
| void | stop () |
| | Stop the realtime publisher.
|
| bool | can_publish () const |
| | Check if the realtime publisher is in a state to publish messages.
|
| bool | try_publish (const MessageT &msg) |
| | Try to publish the given message.
|
| std::thread & | get_thread () |
| | Get the thread object for the publishing thread.
|
| const std::thread & | get_thread () const |
| | Get the thread object for the publishing thread.
|
|
std::mutex & | get_mutex () |
| | Get the mutex protecting the stored message.
|
|
const std::mutex & | get_mutex () const |
| | Get the mutex protecting the stored message.
|
◆ RealtimePublisher() [1/2]
template<class MessageT>
template<typename NodeT>
| realtime_tools::RealtimePublisher< MessageT >::RealtimePublisher |
( |
NodeT && | node, |
|
|
const std::string & | topic_name, |
|
|
const rclcpp::QoS & | qos, |
|
|
const rclcpp::PublisherOptions & | options = rclcpp::PublisherOptions() ) |
|
inlineexplicit |
Constructor for the realtime publisher that creates the publisher internally.
Starts a dedicated thread for message publishing. The publishing thread runs the publishingLoop() function to handle message delivery in a non-realtime context.
- Parameters
-
| node | the node (or node interface/pointer) to create the publisher for |
| topic_name | the topic name on which we want to publish |
| qos | the QoS settings for the publisher |
| options | the publisher options |
◆ RealtimePublisher() [2/2]
Constructor for the realtime publisher.
Starts a dedicated thread for message publishing. The publishing thread runs the publishingLoop() function to handle message delivery in a non-realtime context.
- Parameters
-
| publisher | the ROS publisher to wrap |
◆ can_publish()
Check if the realtime publisher is in a state to publish messages.
- Returns
- true if the publisher is in a state to publish messages
◆ get_thread() [1/2]
Get the thread object for the publishing thread.
This can be used to set thread properties.
◆ get_thread() [2/2]
Get the thread object for the publishing thread.
This can be used to set thread properties.
◆ stop()
Stop the realtime publisher.
Signals the publishing thread to exit by setting keep_running_ to false and notifying the condition variable. This allows the publishing loop to break out of its wait state and exit cleanly.
◆ try_publish()
Try to publish the given message.
This method attempts to publish the given message if the publisher is in a state to do so. It uses a try_lock to avoid blocking if the mutex is already held by another thread.
- Parameters
-
| [in] | msg | The message to publish |
- Returns
- true if the message was successfully published, false otherwise
The documentation for this class was generated from the following file: