-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PTP synchronization takes 30-60 seconds #78
Comments
How do you check if PTP is working? I used ptp4l command and rosbag record from terminal but I dont see any information that shows if the lidar is synced |
The Ouster Software Manual has a good reference on the linux install as the timing source.
Sudo systemctl start ptp4l
sudo ethtool -T eno1, where eno1 is your ethernet interface. Test if your hardware supports ptp.
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
Sudo ptp4l -I eno1 -m -H (hardware timestamping)
Also,
Chronyc tracking
If you are not certain, then most likely it’s not setup. Follow the instructions from the Ouster Software Manual chapter 9 pg 38. If you don’t use an external hardware timesource, then follow the steps on the linux ptp grandmaster clock.
Verifying
Must set TCP config to use TIME_FROM_PTP_1588
1. Nc youroustersensorip 7501
2. Set_config_param timestamp_mode TIME_FROM_PTP_1588
3. Write_config_txt
4. reinitialize
Connect to the sensor using the ouster client to view the data output. This is a live connection with your sensor not using ROS. It may take 1-2 minutes to sync. Find the timestamp in the output. What is the current timestamp anyway?
https://www.andrews.edu/~tzs/timeconv/timedisplay.php (unix timestamp)
ouster_client
https://github.com/ouster-lidar/ouster_example/blob/master/ouster_client/README.md
…---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
|
I have a similar situation. Im having some trouble synchronizing my PTP hardware clock with the system clock. Im able to set the os1 to use PTP_1588 for timestamps and see the hardware clock time on the
Then I tried using phc2sys according to the software user manual which is supposed to sync the hardware clock with the system clock, but after creating The PTP appendix from the software user guide is what i followed, and seperately also went through the redhat chapters (https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-configuring_ptp_using_ptp4l#s2-Advantages_of_PTP) about setting up PTP, and have tried the various github issue suggestions: Output from ethtool:
Output from ptp4l:
Output from phc2sys:
Output from chrony:
Output from /os1_cloud_node/imu (36 seconds ahead of a seperate topic i.e. /imu/data from seperate sensor):
Does anyone know why the delay starts to grow after the use of phc2sys? Thanks in advance. |
Additionally, if i revert (remove) all the changes made for phc2sys, phc2shm, and chrony, and just keep the additions for ptp4l, and then power cycle the sensor, the time delay starts off at almost 0 but starts getting larger but then stabilizes at -0.374 seconds of delay between the os1 and system time.
|
@l0g1x I have the same problem. Enabling |
|
@asherikov Interesting. It does seems like that the TCP query
Seems like the offset would (if it does) happen at the firmware level. Can anyone from Ouster comment on this? Also to mention, im on 16.04 with 4.15.0-55 kernel. Just realized my phc2sys version is at 1.6 so will try updating it and see what happens. @tuandle I did also try the
For what I am trying to achieve, the timestamp which all components on my system utilize needs to be as close to eachother as possible (i.e. for SLAM), and can be different from the time reported by NTP servers, say, like in the case the vehicle is on the road but not connected to internet. What i'm additionally uncertain about is whether the configuration of |
@asherikov does v1.8 allow for both the |
This is how I use it. AFAIK, newer ptp4l (>=1.9) also allows to set the offset to zero. |
I followed the OS1 software guideline to create the
|
Hi @l0g1x Can you tell me how to check the offset between the master and slave time? I have set up my ptp4l and it's working fine. But I need to verify the process of getting the offset time . Thanks |
@Ashik19 try this command |
Thanks for your kind reply. When I am running the command you mentioned its's giving me the following error Can you please guide me on this ? Thanks |
@Dinatorehanova "Permission denied" probably means that you need to run that command as root. Try prefacing it with sudo. |
my question may sound really stupid, my apologies in advance! But to synchronize with an external PTP master, did you use a physical device such as Trimble Thunderbolt ptp GM100 explained in user SW guide? |
@mrgransky nope, I am using a computer with an Intel LAN controller. |
Well, if your ouster is outputting points, and the timestamp is closer to
Unix time than counting up from zero, then you probably got it right.
…On Mon, Jan 13, 2020, 11:57 Farid ***@***.***> wrote:
Sorry for such a long post, in advance!
I have a single NIC on my laptop in which OS1-64 is directly connected and
followed the procedure from SW user guide one by one:
1. $ sudo mkdir -p /etc/systemd/system/ptp4l.service.d
2. $ sudo gedit /etc/systemd/system/ptp4l.service.d/override.conf
3. adding the following lines in
/etc/systemd/system/ptp4l.service.d/override.conffile:
[Service]
ExecStart=
ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i enp0s31f6
1.
Modify the clockClass in /etc/linuxptp/ptp4l.conf:
#clockClass 248
clockClass 128
2.
Start the ptp4l service so the change takes effect:
$ sudo systemctl daemon-reload
$ sudo systemctl restart ptp4l
$ sudo systemctl status ptp4l
● ptp4l.service - Precision Time Protocol (PTP) service
Loaded: loaded (/lib/systemd/system/ptp4l.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/ptp4l.service.d
└─override.conf
Active: active (running) since Mon 2020-01-13 19:15:48 EET; 31s ago
Main PID: 6216 (ptp4l)
Tasks: 1
Memory: 544.0K
CPU: 11ms
CGroup: /system.slice/ptp4l.service
└─6216 /usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i enp0s31f6
Jan 13 19:15:48 xenial-ThinkPad-P51 systemd[1]: Started Precision Time Protocol (PTP) service.
Jan 13 19:15:48 xenial-ThinkPad-P51 ptp4l[6216]: [2710.994] selected /dev/ptp0 as PTP clock
Jan 13 19:15:48 xenial-ThinkPad-P51 ptp4l[6216]: [2710.994] port 1: INITIALIZING to LISTENING on INITIALIZE
Jan 13 19:15:48 xenial-ThinkPad-P51 ptp4l[6216]: [2710.994] port 0: INITIALIZING to LISTENING on INITIALIZE
Jan 13 19:15:55 xenial-ThinkPad-P51 ptp4l[6216]: [2717.757] port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 13 19:15:55 xenial-ThinkPad-P51 ptp4l[6216]: [2717.757] selected best master clock 8c1645.fffe.3f002e
Jan 13 19:15:55 xenial-ThinkPad-P51 ptp4l[6216]: [2717.757] assuming the grand master role
1. $ sudo mkdir -p /etc/systemd/system/phc2sys.service.d
2. $ sudo gedit /etc/systemd/system/phc2sys.service.d/override.conf
and add following contents:
[Service]
ExecStart=
ExecStart=/usr/sbin/phc2sys -w -s CLOCK_REALTIME -c enp0s31f6
1. Start the phc2sys service so the change takes effect:
$ sudo systemctl daemon-reload
$ sudo systemctl start phc2sys
$ sudo systemctl status phc2sys
● phc2sys.service - Synchronize system clock or PTP hardware clock (PHC)
Loaded: loaded (/lib/systemd/system/phc2sys.service; disabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/phc2sys.service.d
└─override.conf
Active: active (running) since Mon 2020-01-13 19:15:48 EET; 10min ago
Main PID: 6217 (phc2sys)
CGroup: /system.slice/phc2sys.service
└─6217 /usr/sbin/phc2sys -w -s CLOCK_REALTIME -c enp0s31f6
Jan 13 19:26:05 xenial-ThinkPad-P51 phc2sys[6217]: [3328.133] sys offset 344 s2 freq -3437 delay 4500
Jan 13 19:26:06 xenial-ThinkPad-P51 systemd[1]: Started Synchronize system clock or PTP hardware clock (PHC).
Jan 13 19:26:06 xenial-ThinkPad-P51 phc2sys[6217]: [3329.134] sys offset 231 s2 freq -3447 delay 4875
Jan 13 19:26:07 xenial-ThinkPad-P51 phc2sys[6217]: [3330.134] sys offset 3 s2 freq -3605 delay 4625
Jan 13 19:26:08 xenial-ThinkPad-P51 phc2sys[6217]: [3331.134] sys offset -211 s2 freq -3818 delay 4625
Jan 13 19:26:09 xenial-ThinkPad-P51 phc2sys[6217]: [3332.134] sys offset -398 s2 freq -4069 delay 4625
Jan 13 19:26:10 xenial-ThinkPad-P51 phc2sys[6217]: [3333.134] sys offset -111 s2 freq -3901 delay 4500
Jan 13 19:26:11 xenial-ThinkPad-P51 phc2sys[6217]: [3334.135] sys offset -493 s2 freq -4316 delay 4625
Jan 13 19:26:12 xenial-ThinkPad-P51 phc2sys[6217]: [3335.135] sys offset 55 s2 freq -3916 delay 4750
Jan 13 19:26:13 xenial-ThinkPad-P51 phc2sys[6217]: [3336.135] sys offset 438 s2 freq -3517 delay 4625
1. $ sudo gedit /etc/systemd/system/phc2shm.service and add following:
# /etc/systemd/system/phc2shm.service
[Unit]
Description=Synchronize PTP hardware clock (PHC) to NTP SHM
Documentation=man:phc2sys
After=ntpdate.service
Requires=ptp4l.service
After=ptp4l.service
[Service]
Type=simple
ExecStart=/usr/sbin/phc2sys -s enp0s31f6 -E ntpshm -w
[Install]
WantedBy=multi-user.target
1. start the newly created service and check that it started:
$ sudo systemctl start phc2shm
$ sudo systemctl status phc2shm
***@***.***:~$ sudo systemctl status phc2shm
● phc2shm.service - Synchronize PTP hardware clock (PHC) to NTP SHM
Loaded: loaded (/etc/systemd/system/phc2shm.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2020-01-13 19:15:48 EET; 11min ago
Docs: man:phc2sys
Main PID: 6218 (phc2sys)
CGroup: /system.slice/phc2shm.service
└─6218 /usr/sbin/phc2sys -s enp0s31f6 -E ntpshm -w
Jan 13 19:27:01 xenial-ThinkPad-P51 phc2sys[6218]: [3384.141] phc offset -808 s0 freq +0 delay 3121
Jan 13 19:27:02 xenial-ThinkPad-P51 phc2sys[6218]: [3385.141] phc offset -141 s0 freq +0 delay 1975
Jan 13 19:27:03 xenial-ThinkPad-P51 phc2sys[6218]: [3386.141] phc offset -161 s0 freq +0 delay 3247
Jan 13 19:27:04 xenial-ThinkPad-P51 phc2sys[6218]: [3387.141] phc offset -43 s0 freq +0 delay 3227
Jan 13 19:27:05 xenial-ThinkPad-P51 phc2sys[6218]: [3388.141] phc offset -46 s0 freq +0 delay 3187
Jan 13 19:27:06 xenial-ThinkPad-P51 phc2sys[6218]: [3389.142] phc offset -159 s0 freq +0 delay 3671
Jan 13 19:27:07 xenial-ThinkPad-P51 phc2sys[6218]: [3390.142] phc offset -351 s0 freq +0 delay 3072
Jan 13 19:27:08 xenial-ThinkPad-P51 phc2sys[6218]: [3391.142] phc offset -260 s0 freq +0 delay 3118
Jan 13 19:27:09 xenial-ThinkPad-P51 phc2sys[6218]: [3392.142] phc offset -207 s0 freq +0 delay 3148
Jan 13 19:27:10 xenial-ThinkPad-P51 phc2sys[6218]: [3393.142] phc offset -46 s0 freq +0 delay 3114
1.
Append the following line in /etc/chrony/chrony.conf:
refclock SHM 0 poll 1 refid ptp
2.
$ sudo systemctl restart chrony
3.
$ chronyc tracking
Reference ID : 112.116.112.0 (ptp)
Stratum : 1
Ref time (UTC) : Mon Jan 13 17:29:31 2020
System time : 0.000001780 seconds fast of NTP time
Last offset : +0.000014786 seconds
RMS offset : 0.000730798 seconds
Frequency : 4.300 ppm slow
Residual freq : -0.187 ppm
Skew : 0.602 ppm
Root delay : 0.000000 seconds
Root dispersion : 0.000246 seconds
Update interval : 2.0 seconds
Leap status : Normal
1. $ chronyc sources -v
210 Number of sources = 5
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
#* ptp 0 1 377 3 -166ns[ -196ns] +/- 140us
^- 2606:4700:f1::1 3 6 37 33 +12ms[ +12ms] +/- 11ms
^- 2606:4700:f1::123 3 6 37 34 -166us[ -166us] +/- 22ms
^- ntp2.snopyta.org 3 6 37 33 -1440us[-1440us] +/- 62ms
^- leopardi.miuku.net 2 6 37 32 +12ms[ +12ms] +/- 36ms
1. Verify state of local PTP service through the HTTP system/time/ptp:
$ curl -s os1-991941001031.local/api/v1/system/time/ptp | jq -S
{
"current_data_set": {
"mean_path_delay": 41255,
"offset_from_master": 77236,
"steps_removed": 1
},
"parent_data_set": {
"gm_clock_accuracy": 254,
"gm_clock_class": 128,
"gm_offset_scaled_log_variance": 65535,
"grandmaster_identity": "8c1645.fffe.3f002e",
"grandmaster_priority1": 128,
"grandmaster_priority2": 128,
"observed_parent_clock_phase_change_rate": 2147483647,
"observed_parent_offset_scaled_log_variance": 65535,
"parent_port_identity": "8c1645.fffe.3f002e-1",
"parent_stats": 0
},
"port_data_set": {
"announce_receipt_timeout": 3,
"delay_mechanism": 1,
"log_announce_interval": 1,
"log_min_delay_req_interval": 0,
"log_min_pdelay_req_interval": 0,
"log_sync_interval": 0,
"peer_mean_path_delay": 0,
"port_identity": "bc0fa7.fffe.0011bc-1",
"port_state": "SLAVE",
"version_number": 2
},
"profile": "default",
"time_properties_data_set": {
"current_utc_offset": 36,
"current_utc_offset_valid": 0,
"frequency_traceable": 0,
"leap59": 0,
"leap61": 0,
"ptp_timescale": 1,
"time_source": 160,
"time_traceable": 0
},
"time_status_np": {
"cumulative_scaled_rate_offset": 0,
"gm_identity": "8c1645.fffe.3f002e",
"gm_present": true,
"gm_time_base_indicator": 0,
"ingress_time": 1578936901656705800,
"last_gm_phase_change": "0x0000'0000000000000000.0000",
"master_offset": 77236,
"scaled_last_gm_phase_change": 0
}
}
so parent_data_set.grandmaster_identity is the identity of the local
grandmaster bc0fa7.fffe.0011bc-1 and port_data_set.port_state is SLAVE.
1. $ sudo pmc 'get CURRENT_DATA_SET' -i enp0s31f6
sending: GET CURRENT_DATA_SET
bc0fa7.fffe.0011bc-1 seq 0 RESPONSE MANAGEMENT CURRENT_DATA_SET
stepsRemoved 1
offsetFromMaster -106139.0
meanPathDelay 28059.0
1. Waiting for 2 min, from ouster_client package:
$ ./ouster_client_example <os1_hostname> <data_destination_ip>
n_lidar_packets col_0_azimuth col_0_ts n_imu_packets im_av_z im_la_y imu_ts
110553 6.18501 1578938056751576832 17300 0.862122 -0.00952148 1578938056748440843
so how can I know my sensor is synchronized successfully?
Cheers,
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#78>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMFIWCBUKCG7ZN7SINWZSLQ5STPVANCNFSM4H5VVJOQ>
.
|
For example, After setting up the PTP from the official documentation. I am getting the following outputs for the command:
and output from the HTTP server as follows
I have the same question @daniel-dsouza, How to verify that the PTP synchronization is working correctly? |
Hi all, We have a useful little tool called the timestomper.py which is the best and most accurate way to verify your sensor's time sync with PTP. The code for timestomper.py is below:
Regarding leap seconds in ptp4l and ROS please reference #144 (comment) Thanks! |
Regarding converging PTP faster checkout How to enable PTP Profiles on Ouster Sensor The |
Hi, I just want to ask that I am trying to communicate the one server and 2 clients using UDP protocol to send a file but I need to synchronization of it. I mean I want to synchronize 3 virtual machines (2 clients and 1 server) without a cable connection, but for start, I will do wired PTP synchronization. The time must be as close as possible to each other in the client PCs (low latency). I will look forward to hearing from you. |
Do I need to run ptp4l and phc2sys for the different terminals? Since for example while ptp4l working it continues and never stops, do I need to open a new terminal window to run the phc2sys there (also the same with PMC)? I wonder how to use ptp4l and phc2sys. Since hardware time stamping is more accurate actually I want to use both, If I am not wrong if I need to use hardware stamping I need to use phc2sys however how to run these two things? |
I have 3 PCs with 1 router LAN wired connected for clock PTP synchronization. I do not understand why 2 of them behave as a grandmaster(servers) and the 1 other one is a slave. Actually do not suppose to be 1 grandmaster and the other 2 clients (Ordinary clock). Does the router behave as a boundary clock? I want to do synchronization among 3 PCs. |
Hello
I am trying to sync lidar with my NVIDIAJetson Xavier using ptp. Everything works well, but it takes 30-60 seconds to sync. As soon as api call (
api/v1/system/time/ptp
) shows ptp info, the delay is minimized to 0.2 seconds (measured with rostopic delay command.).I followed lidar documentation, on how to setup ptp server. Running ptp4l, lidar timestamp mode is set to
TIME_FROM_PTP_1588
and Wireshark shows that PTPv2 protocol broadcasts are working.I would like to get the correct timestamp as soon as lidar starts sending data. Is there any way to remove the delay on minimizing it?
The text was updated successfully, but these errors were encountered: