-
Notifications
You must be signed in to change notification settings - Fork 119
New Robot: Ouster OS 1 Setup PTP
The Ouster OS-1 timestamp does not follow Unix time, and as a result the matching messages with other sensors in ROS is difficult. We use PTP synchronization to synchronize the OS-1 Clock using the Robot NUC computer.
This page details:
- Set up a static IP for the OS-1 (preferable over the default DHCP).
- Set up the network connection between the NUC and the OS-1.
- Set up PTP to synchronize OS-1 clock with NUC clock.
- Change the lidar mode (2048x10).
Follow the instructions described in Issue: Setting static IP address #114:
Take note of the Serial Number of the lidar you are configuring by looking on the top sticker of the unit. There should be a 12 digit number. This hostname of this unit is os-xxxxxxxxxxxx.local
where the x's are the 12 digit number. This hostname will be referred to as [sensor_hostname]
Connect the OS-1 to the Motherboard on the robot through ethernet. Run ip a
to see if there is a connection through the ethernet interface (typically enp0s31f6
) on the robots.
If there is no IP address for your ethernet device, through NetworkManager, simply change the IPV4 connection to "Link-Local Only" and run sudo systemctl restart NetworkManager.service
and then run ip a
. If you notice the address is still missing from this command, perform a reboot to the system.
After seeing an address is assigned to the ethernet device, simply ping -4 -c3 [sensor_hostname]
There should be a response with an IP address. This is the IP address of the Ouster unit and will be referred to as [DHCP_LL_IP_ADDRESS] throughout the remainder of this guide.
Choose the OS-1 Static IPv4 Address to set [STATIC_IP_ADDRESS], 192.168.100.12 should be used for this, as to keep consistency throughout the platforms.
Set the Static IP:
echo '"[STATIC_IP_ADDRESS]/24"' | http -v PUT http://[DHCP_LL_IP_ADDRESS]/api/v1/system/network/ipv4/override
Now that the Ouster Static IP Address is set, one must configure the host machine to be able to reach that address. This is done by using NetworkManager to set a Static IP of 192.168.100.1
. From there, run sudo systemctl restart NetworkManager.service
and then run ip a
. If you notice the address of your ethernet device is not 192.168.100.1
, perform a reboot to the system.
From there, ping 192.168.100.12
to confirm you have a proper connection to the Static IP that was set on the Ouster.
The high level steps are:
- Tell ethernet card to be a PTP grandmaster by giving it a high priority (clockClass, lower numbers are higher priority)
- Tell OS-1 to use the PTP time for it's timestamping and save this config to EEPROM
- Start a daemon (phc2sys) to synchronize linux system time with the clock on the ethernet interface with an offset of 0.
- Configure the daemons to start on boot
IMPORTANT: these steps have been tested with Ubuntu 22. Lower versions of Ubuntu may have a different configuration, particularly because the services are not interface dependent.
Install the following on the Robot NUC:
sudo apt install linuxptp ethtool
It is a good idea to clear old override files. These files could be dangling from older versions of Ubuntu if the system was reinstalled. To do this:
systemctl disable phc2sys.service
systemctl disable ptp4l.service
cd /etc/systemd/system
rm -rf phc2sys*
rm -rf ptp4l*
We need to override this file as the default configuration is not adequate. Replace interface
with your interface name (enp5s0, enp6s0).
systemctl edit --full [email protected]
Change the lines
Requires=ptp4l.service
After=ptp4l.service
To
And change the last line ExecStart
to (replace interface
)
ExecStart=
ExecStart=/usr/sbin/phc2sys -s CLOCK_REALTIME -c interface -O 0
Note that the l
in ptp4l.conf
is an "el", not a "one".
Change the clockClass
to 128:
sudo vim /etc/linuxptp/ptp4l.conf
(Optional) If the OS-1 is on a network interface other than eth0, Append to the end (brackets included), replacing interface with enp5s0, enp6s0, etc.
[interface]
Replace interface
with your interface name (enp5s0, enp6s0).
sudo systemctl daemon-reload
sudo systemctl enable --now [email protected]
sudo systemctl enable --now [email protected]
Open Netcat,changing 192.168.100.12 to the static IPv4 you set for the OS-1:
netcat 192.168.100.12 7501
After this, nothing will be displayed, directly continue to run:
set_config_param timestamp_mode TIME_FROM_PTP_1588
reinitialize
write_config_txt
Important:Don't do this on Xavier.
sudo systemctl enable phc2sys
Then reboot and power cycle the Ouster.
Check the linux time on the NUC
date +%s
Check the OS-1 time using netcat:
netcat 192.168.100.12 7501
get_time_info
The two times should match. If the PTP synchronization does not work, then get_time_info
would return the number of seconds since the OS-1 was turned on.
netcat 192.168.100.12 7501
get_config_param active lidar_mode
set_config_param lidar_mode 2048x10
write_config_txt
reinitialize
The new lidar mode should be reflected in the Ouster webpage:
- Build and Install:
- Simulation Experiments:
- Real-world Experiments:
- Hardware requirements
- Install real robot code stack
- Safety protocol & preflight check
- Launch experiment and gain tuning
- Supported features:
- Integrate (semantic) SLAM for drift correction
- LIDAR-only autonomous flight
- Full coverage experiments
- Customize configurations: