[ROS2] How to pass options to a component node via launch.py
I created ROS2 component which I can run as a normal ROS2 node with the following code.
int main(int argc, char *argv[])
{
// Force flush of the stdout buffer.
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
// Initialize any global resources needed by the middleware and the client library.
// This will also parse command line arguments one day (as of Beta 1 they are not used).
// You must call this before using any other part of the ROS system.
// This should be called once per process.
rclcpp::init(argc, argv);
// 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::SingleThreadedExecutor exec;
rclcpp::NodeOptions options;
options.use_intra_process_comms(true);
options.append_parameter_override("detector_type", "robot");
// Add some nodes to the executor which provide work for the executor during its "spin" function.
// An example of available work is executing a subscription callback, or a timer callback.
auto component = std::make_shared<DetectorComponent>(options);
exec.add_node(component);
// spin will block until work comes in, execute work as it becomes available, and keep blocking.
// It will only be interrupted by Ctrl-C.
exec.spin();
rclcpp::shutdown();
return 0;
}
As you can see I activate the intra process communication and add an additional parameter to the options. My questions is now, how can I achieve the same with a ComposableNode in a launch file? To do it without the option is clear but I don't know how I can "modify" the options and pass it to the component via launch.py.