chrono::ros::ChROSHandlerRegistry Class Reference
Description
Registry for handler publishing functions in the subprocess.
Each handler type registers a function that deserializes data and publishes to ROS. This makes the subprocess dispatcher completely generic - it just looks up and calls the registered function for each message type.
BIDIRECTIONAL: Handlers can also use the IPC channel to send data back to main process (e.g., subscribers sending received ROS messages back to Chrono simulation)
#include <ChROSHandlerRegistry.h>
Public Types | |
| using | PublishFunction = std::function< void(const uint8_t *, size_t, rclcpp::Node::SharedPtr, ipc::IPCChannel *)> |
| Function signature for handler publish functions Takes serialized data bytes (raw pointer + size to avoid copy), ROS node, and IPC channel. | |
Public Member Functions | |
| void | RegisterPublisher (ipc::MessageType msg_type, PublishFunction publish_func) |
| Register a handler's publish function. More... | |
| bool | Publish (ipc::MessageType msg_type, const uint8_t *data, size_t data_size, rclcpp::Node::SharedPtr node, ipc::IPCChannel *channel=nullptr) |
| Publish data using the registered handler. More... | |
| bool | HasPublisher (ipc::MessageType msg_type) const |
| Check if a handler is registered for this message type. | |
Static Public Member Functions | |
| static ChROSHandlerRegistry & | GetInstance () |
| Get the singleton instance. | |
Member Function Documentation
◆ Publish()
|
inline |
Publish data using the registered handler.
- Parameters
-
msg_type Message type identifier data Pointer to serialized data bytes data_size Size of data in bytes node ROS node for publishing channel IPC channel for bidirectional communication (can be nullptr)
- Returns
- true if handler was found and called, false otherwise
◆ RegisterPublisher()
|
inline |
Register a handler's publish function.
- Parameters
-
msg_type Message type identifier publish_func Function to call when this message type is received
The documentation for this class was generated from the following file:
- /builds/uwsbel/chrono/src/chrono_ros/ChROSHandlerRegistry.h