How to create a custom clock using roscpp
I was thinking of a way of creating a custom clock that I can use to step all my nodes.
I investigated a bunch of complicated things like using the Player class from rosbag, but I think I am overcomplicating this.
Is there any example of just creating a custom clock? I was trying to see if there was a test in ros_comm or ros_comm_msgs but I could not find anything.
Thank you for your help!
quick comment: just create a publisher publishing rosgraph_msgs/Clock, making sure to keep track of whatever time you want to publish.
Make sure there is only one, publish to the correct topic (ie:
/clock
) and setuse_sim_time
totrue
for all involved nodes.That'd be it.
See also wiki/Clock.