How time, clock and duration work in ROS 2 and how it is different from ROS 1?

asked 2022-09-14 17:42:05 -0600

mr.muze gravatar image

updated 2022-09-15 07:09:08 -0600

ravijoshi gravatar image

I am porting code from ROS 1 to ROS 2 and am fumbling when it comes to time, clocks and duration. I understand how it works in ROS1 and its corresponding API. I am unclear as to how it works in ROS 2 and why we need a node to get the time (e.g. node->get_clock()->now() in ROS 2 vs ros::Time::now() in ROS 1)

Can someone please conceptually explain how time works in ROS 2 and how it is different from ROS 1?

Thank you in advance!

edit retag flag offensive close merge delete