ROS Intra-Process Communication
ROS2 IPC bypasses the middleware, so you don’t have to serialize the message that is being sent.
Some resources
- https://docs.ros.org/en/iron/Tutorials/Demos/Intra-Process-Communication.html
- https://design.ros2.org/articles/intraprocess_communications.html
- https://design.ros2.org/articles/zero_copy.html
See Composable Node for actual implementation.
Important: you need the following (taken from https://github.com/stereolabs/zed-ros2-wrapper/blob/master/zed_wrapper/src/zed_wrapper.cpp)
// Create an executor that will be responsible for execution of callbacks for a set of nodes.
// With this version, all callbacks will be called from within this thread (the main one).
rclcpp::executors::MultiThreadedExecutor exec;
rclcpp::NodeOptions options;
options.use_intra_process_comms(true);
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
# ..
ld.add_action(ComposableNodeContainer(
name='a_buncha_nodes',
namespace='',
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
ComposableNode(
package='palomino',
plugin='palomino::VincentDriver',
name='vincent_driver',
# ..
extra_arguments=[{'use_intra_process_comms': True}],
),
]
))
in Nitros
So that is set at the publisher level, not the node level?
NitrosPublisher
does not inherit from rclcpp::Node
. NitrosNode
does.
void NitrosPublisher::addSupportedDataFormat(
const std::string & data_format,
const double weight)
{
rclcpp::PublisherOptions pub_options;
pub_options.use_intra_process_comm = rclcpp::IntraProcessSetting::Enable;