- 1 Robot Time and NTP
- 1.1 Introduction
- 1.2 Overview
- 1.3 How to Use NTP
- 1.4 Configuration
- 1.5 Resources
- 1.6 Troubleshooting
Robot Time and NTP
The Network Time Protocol (NTP) is run on the robot to keep the robot's system time accurate.
By default, your robot will automatically use NTP to synchronize its system clock when connected to the internet. Large offsets are corrected at boot, while small inaccuracies are handled gradually during run-time.
To correct your robot's time, reboot your robot while having it connected to the internet.
You can check the time on the robot with the
$ ntpdate -q <robot_address> server 192.168.0.1, stratum 2, offset -0.000680, delay 0.03934 5 Oct 18:32:31 ntpdate: adjust time server 192.168.52.242 offset -0.000680 sec
This will tell you the difference between your computer's time (the time on the left) and the robot's system clock.
If you cannot connect your Sawyer to the internet or need to set a custom configuration, see the Configuration Section.
Baxter's on-board time is kept accurate using the standard NTP time service. The default configuration will set the robot's time once during startup each time the robot boots, and then will maintain a running NTP server that will gradually slew the time to keep the robot's system time in sync. The default time servers are received from pool.ntp.org, but these can be configured by either providing the
ntp-servers option from your DHCP host, or using the ntpdc tool to configure the running NTP server.
Note: NTP was first enabled in version 0.6.2 of the RSDK. Make sure you are running rsdk-0.6.2 or above to use these services.
NTP on Baxter
NTP runs automatically on Baxter in two parts:
ntp-clientscript runs on boot to correct large time offsets.
ntpdservice then runs an NTP timeserver to gradually keep the time accurate for small time differences.
The final important piece is the
ntp.conf configuration used for both these services. This determines which reference time servers the robot should use to synchronize against.
Default settings should work for most people to keep Baxter's time accurate. Users can query the status of the robot's NTP timeserver using various NTP tools including: ntpdate, ntpq, and ntpdc.
For the advanced users, the above NTP services can be configured using DHCP or the run-time ntpdc client.
NTP will sync your robot's time to "real-world" time, but you still need to set the robot's timezone. The robot's timezone can be set using the Field-Service-Menu. This does not affect the time kept by NTP as that will be based on UTC, however it will affect the offset used for the displayed system time.
How to Use NTP
How to Check Robot Time
You can use the ntpdate tool for a simple reference check against the robot, or use the ntpq.html ntpq) tool to check the status of the NTP timeserver and Baxter's synchronization, among other details.
Make sure you have installed the ntp tools:
$ sudo apt-get install ntp
Query the status of the NTP server on the robot:
$ ntpq -p <robot_address> remote refid st t when poll reach delay offset jitter ============================================================================== *server2.shellva 188.8.131.52 2 u 1712 1024 376 10.225 1.013 3.852 *184.108.40.206 220.127.116.11 2 u 42 1024 217 52.744 -7.044 10.286 kona.skafari.co 18.104.22.168 2 u 1694 1024 376 8.558 -1.378 16.680 *sisdb01.muskego 22.214.171.124 3 u 358 1024 377 35.632 -3.661 7.991
This lists the known synchronization references (and their "refid" references) of the robot’s ntp server. These are the servers and peer timeservers that the robot’s NTP daemon/server is trying to sync against. The first character in a row indicates the current Selection status (‘*’ means active). See ‘Select Field’: http://www.eecis.udel.edu/~mills/ntp/html/decode.html#peer
Compare Reference Time
You can compare the robot's time to your system's time using the
-q ntpdate command:
$ ntpdate -q <robot_ip>
How to Fix Robot Time
Robot time is fixed by connecting the robot to timeservers. This must happen at boot for large offsets. Smaller inaccuracies (~17min) are handled regularly during run-time.
By default the NTP services are configured to get four servers from the NTP Pool Project at pool.ntp.org. On boot, if the robot can reach these servers -- i.e. if the robot can connect to the internet -- the
ntp-client corrects the robot's time, setting it to the reference time from the servers in one big jump. After this the robot's
ntpd timeserver will continue to synchronize against these four servers.
Setting the Time on Boot
In order to set large offsets, the boot-time
ntp-client need to be able to connect to the configured NTP servers. If using the default settings, this just means the robot can reach the internet. If your robot cannot connect to the internet, or you wish to use different servers during boot time, you can provide those servers using the
ntp-servers option in your DHCP servers configuration.
Once the robot has accurate time, it will save that time to the hardware clock on shutdown.
Using DHCP to provide the
ntp-servers option is the standard way to provide NTP configuration information on a network. Your local network may already be configured to provide this information.
8.3. Network Time Protocol Servers Option
This option specifies a list of IP addresses indicating NTP 
servers available to the client. Servers SHOULD be listed in order
Running Locally with DHCP
If you need to correct the time locally (without being on a network), you can setup your own DHCP server on a local machine with a tool such as
isc-dhcp-server. Make sure to run an NTP server on your own machine and provide the address of your machine as the address in the
If your dev machine is not connected to other authentic time servers, you will need to
fudge your own local time as a valid source of authentication. By default, NTP does not sync against stratum 16 servers (which is what a disconnected server is). "Stratum" indicates the number of hops you are away from a 'true' time source (stratum 1), such as a GPS based device.
= Add backup fake local server = server 127.127.1.1 # local clock fudge 127.127.1.1 stratum 12 # increase stratum
ntpdc tool is a program that can be run on the dev machine to query and configure the robot's NTP timeserver. Configuration changes made at run-time using this tool are only currently saved for that boot.
Configuring the NTP Server at Run-Time
ntpdc tool to configure the NTP server at run-time. The easiest method is to use the interactive mode.
- Get the NTP Authentication Key information from the Rethink FTP - RSDK Resources folder. Your POC (Point-of-Contact) should have access to this service.
- In a terminal on your computer, drop into interactive mode:
$ ntpdc -i <robot_address>
- Authenticate your ntpdc session. Using the authentication file above:
= Use the keyid number found at the start of the line = ntpdc> keyid #<number> = Use the MD5 password found in the middle of the line = ntpdc> passwd MD5 Password: #<Copy-&-Paste middle value of key in keys file here>
- Now add a reference to your prefered time server.
- Add a server using the
addservercommand; use the
preferoption to prioritize it:
ntpdc> addserver ntp0.rethink.cxm prefer
List Status with ntpdc
You can also use the
ntpdc tool to list the current status of the robot's NTP synchronization.
- From inside an interactive session, use the
ntpdc> peers remote local st poll reach delay offset disp ======================================================================= *kona.skafari.co 192.168.52.242 2 1024 373 0.00854 0.000148 0.15186 =server2.shellva 192.168.52.242 2 1024 372 0.01021 0.001264 0.15143 =sisdb01.muskego 192.168.52.242 3 1024 377 0.03574 -0.003096 0.13756 =126.96.36.199 192.168.52.242 2 1024 77 0.05266 -0.003718 0.27809
- This is the same as using the
ntpq -p <robot>command.
If you want to remove the default servers from the current configuration, you can remove the peers by reference.
- Drop into interactive mode as shown above.
- Authenticate as shown above.
- List peers (for finding their reference names):
ntpdc> listpeers client kona.skafari.com client blah.servers.net client server2.shellvatore.us client 188.8.131.52
- Unconfigure each peer/server by address (right side of above):
ntpdc> unconfig <peer_address>
- ntpq - standard NTP query program:
- ntpdc - special NTP query program (for configuration commands):
- ntpd - Network Time Protocol (NTP) daemon:
- Command Index - (all the commands available in the ntp.conf configuration file and the ntpdc(/future ntpq versions) tools: