====== Timing when using ROS ====== Back to [[getting_started:ros|]]. The [[eeros_architecture:control_system: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. ===== Synchronizing to Topics ===== 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. ==== ROS1 ==== Study the code in [[https://github.com/eeros-project/eeros-framework/blob/master/examples/ros/RosExample.cpp|RosExample.cpp]] to understand how the executor can be triggered by incoming messages. ==== ROS2 ==== Each subscriber block has a parameter named ''sync''. When set to ''true'' the executor runs whenever a new message is received on this topic.