ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Why robot needs to set NTP?

asked 2012-03-28 00:50:41 -0600

sam gravatar image

In turtlebot tutorials NTP , why turtlebot robot needs to set Network Time Protocol?

  1. If I didn't set that protocol, what will happen? cause some errors?

  2. Every robot needs NTP?

Thank you~

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2012-03-28 02:26:16 -0600

Lorenz gravatar image

updated 2012-03-28 03:13:53 -0600

To have TF and all the other time based things properly, it is important to have all clocks synchronized. NTP is just a very simple way to achieve that. Another one that is used e.g. on the PR2 is chrony.

If you don't set up NTP everything will be working fine as long as you are executing it on the same PC. If you have a setup using several computers communicating over a network, make sure that times are synchronized.

Edit: Sensors, odometry, etc. publish data with a time-stamp that is generated from using system time which is set by NTP. The stamp is then used by TF to transform between coordinate frames. Example: You have a tilting laser sensor. The position of the tilt-joint and the laser scans are continuously published on topics, with a time stamp. If you now want to build up a 3D point cloud in your robot's base frame, you need to transform each laser point (using its time stamp) to the base frame, using the position of the joint at the time when the laser scan has been taken. If now the joint and the laser are connected to two different computers and the clocks are not synchronized, the resulting point cloud will be wrong.

edit flag offensive delete link more


What's the relation between with TF and NTP? And why synchronize is important when run 2 computers?

sam gravatar image sam  ( 2012-03-28 02:56:02 -0600 )edit

If you are a TF user you can lookup a transformation in a bounded time interval. This is useful for instance if you untrust older transformations due to movement of the frames. Therefore time synchronization is important.

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2012-03-28 03:34:49 -0600 )edit

In any case IMHO TF should handle uncertainty for hidding or muffling little time synchronizations errors (or frames in movement, etc.).

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2012-03-28 03:36:47 -0600 )edit

Another useful alternative to NTP is PTPd ( To me PTPd is easier to setup and use if some of your machines do not have an internet connection, since you can set one machine as master and all the other machines as slaves that will try to sync their time with the master.

Thomas D gravatar image Thomas D  ( 2012-03-28 03:39:18 -0600 )edit

Question Tools


Asked: 2012-03-28 00:50:41 -0600

Seen: 1,114 times

Last updated: Mar 28 '12