I am running ROS2 Humble Hawksbill, I have a requirement where in I need to associate two executors StaticSingleThreadedExecutors
for a lifecycle single node. I searched for examples. and demos in ros2 org on github, but in vain. Please be kind to enlighten me on how to achieve this in C++.
2 Answers
Adding two single threaded executors to a node doesn't especially make sense. What you are doing then is creating a multi-threaded executor. However because the two single threaded executors do not know about each other, they can't do appropriate multi-threading interactions.
This sounds a lot like an XY problem. I would suggest that you explain more about your motivation and make sure that you're asking the right question versus making an assumption about your requirements.
cbg_executor example is what you need. Please refer the example here, https://github.com/ros2/examples/tree/humble/rclcpp/executors/cbg_executor