Back to Interfacing with ROS.
The Executor uses the system time per default to run its time domains. When using ROS it might be advantageous to use the same time for the executor as ROS is using. This can be accomplished by calling
Executor::instance()::syncWithRosTime();
The executor will now be synched with the ROS time base. All the blocks will use the ROS time as well. Do this at the very beginning when setting the system up.
ROS itself has a concept of executors, see https://docs.ros.org/en/humble/Concepts/About-Executors.html. They are used to invoke the callbacks of subscriptions, timers, service servers and action servers.
When running EEROS together with ROS and Gazebo you can synchronize EEROS with topics it subscribes to. The executor in EEROS will run whenever a new message gets published on such a topic. The use differs slightly for ROS1 and ROS2.
Study the code in RosExample.cpp to understand how the executor can be triggered by incoming messages.
Each subscriber block has a parameter named sync
. When set to true
the executor runs whenever a new message is received on this topic.