Predependence:
sudo apt install linuxptp ethtool netcat-traditional
Check hardware support:
rover@agx:~$ sudo ethtool -T eth0
[sudo] password for rover:
Time stamping parameters for eth0:
Capabilities:
hardware-transmit (SOF_TIMESTAMPING_TX_HARDWARE)
software-transmit (SOF_TIMESTAMPING_TX_SOFTWARE)
hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off (HWTSTAMP_TX_OFF)
on (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
none (HWTSTAMP_FILTER_NONE)
ptpv1-l4-sync (HWTSTAMP_FILTER_PTP_V1_L4_SYNC)
ptpv1-l4-delay-req (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ)
ptpv2-l4-sync (HWTSTAMP_FILTER_PTP_V2_L4_SYNC)
ptpv2-l4-delay-req (HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ)
ptpv2-l2-sync (HWTSTAMP_FILTER_PTP_V2_L2_SYNC)
ptpv2-l2-delay-req (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ)
ptpv2-event (HWTSTAMP_FILTER_PTP_V2_EVENT)
Look under Capabilities for hardware support.
rover@agx:~$ sudo systemctl status ptp4l
● ptp4l.service - Precision Time Protocol (PTP) service
Loaded: loaded (/lib/systemd/system/ptp4l.service; enabled; vendor preset: en
Active: active (running) since Thu 2022-04-21 11:13:39 CST; 3h 8min ago
Docs: man:ptp4l
Main PID: 19972 (ptp4l)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/ptp4l.service
└─19972 /usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0
4月 21 13:39:11 agx ptp4l[19972]: [12082.563] port 1: LISTENING to FAULTY on FAU
4月 21 13:39:13 agx ptp4l[19972]: [12084.568] port 1: link up
4月 21 13:39:13 agx ptp4l[19972]: [12084.569] port 1: FAULTY to LISTENING on FAU
4月 21 13:39:18 agx ptp4l[19972]: [12088.947] port 1: link down
4月 21 13:39:18 agx ptp4l[19972]: [12088.947] port 1: LISTENING to FAULTY on FAU
4月 21 13:39:20 agx ptp4l[19972]: [12091.888] port 1: link up
4月 21 13:39:20 agx ptp4l[19972]: [12091.889] port 1: FAULTY to LISTENING on FAU
4月 21 13:39:31 agx ptp4l[19972]: [12098.802] port 1: LISTENING to MASTER on ANN
4月 21 13:39:31 agx ptp4l[19972]: [12098.802] selected best master clock 48b02d.
4月 21 13:39:31 agx ptp4l[19972]: [12098.802] assuming the grand master role
Look for "assuming the grand master role".
Set up ouster PTP mode
rover@agx:~$ sudo update-alternatives --config nc
There are 2 choices for the alternative nc (providing /bin/nc).
Selection Path Priority Status
------------------------------------------------------------
0 /bin/nc.openbsd 50 auto mode
1 /bin/nc.openbsd 50 manual mode
* 2 /bin/nc.traditional 10 manual mode
Select "nc.traditional".
To find the ip address and port of the ouster lidar:
rover@agx:~$ avahi-browse -lr _roger._tcp
+ eth0 IPv6 Ouster Sensor 122130000067 _roger._tcp local
+ eth0 IPv4 Ouster Sensor 122130000067 _roger._tcp local
= eth0 IPv6 Ouster Sensor 122130000067 _roger._tcp local
hostname = [os-122130000067.local]
address = [fe80::be0f:a7ff:fe00:331d]
port = [7501]
txt = ["fw=ousteros-image-prod-aries-v2.1.2+20210727223313.patch-v2.1.2" "sn=122130000067" "pn=840-102145-D"]
= eth0 IPv4 Ouster Sensor 122130000067 _roger._tcp local
hostname = [os-122130000067.local]
address = [169.254.102.121]
port = [7501]
txt = ["fw=ousteros-image-prod-aries-v2.1.2+20210727223313.patch-v2.1.2" "sn=122130000067" "pn=840-102145-D"]
To set up the ptp mode for the lidar:
rover@agx:~$ nc 169.254.102.121 7501
get_time_info
{"timestamp": {"time": 1142.70730076, "mode": "TIME_FROM_INTERNAL_OSC", "time_options": {"ptp_1588": 1650520700, "sync_pulse_in": 0, "internal_osc": 1142}}, "sync_pulse_in": {"locked": 0, "polarity": "ACTIVE_HIGH", "diagnostics": {"last_period_nsec": 0, "count": 0, "count_unfiltered": 1}}, "multipurpose_io": {"mode": "OFF", "sync_pulse_out": {"polarity": "ACTIVE_HIGH", "frequency_hz": 1, "angle_deg": 360, "pulse_width_ms": 10}, "nmea": {"locked": 0, "polarity": "ACTIVE_HIGH", "ignore_valid_char": 0, "baud_rate": "BAUD_9600", "leap_seconds": 0, "diagnostics": {"decoding": {"utc_decoded_count": 0, "date_decoded_count": 0, "not_valid_count": 0, "last_read_message": ""}, "io_checks": {"start_char_count": 0, "char_count": 0, "bit_count": 1, "bit_count_unfiltered": 0}}}}}
set_config_param timestamp_mode TIME_FROM_PTP_1588
set_config_param
reinitialize
reinitialize
save_config_params
save_config_params
get_time_info
{"timestamp": {"time": 1650520777.925929, "mode": "TIME_FROM_PTP_1588", "time_options": {"ptp_1588": 1650520777, "sync_pulse_in": 0, "internal_osc": 1220}}, "sync_pulse_in": {"locked": 0, "polarity": "ACTIVE_HIGH", "diagnostics": {"last_period_nsec": 0, "count": 0, "count_unfiltered": 1}}, "multipurpose_io": {"mode": "OFF", "sync_pulse_out": {"polarity": "ACTIVE_HIGH", "frequency_hz": 1, "angle_deg": 360, "pulse_width_ms": 10}, "nmea": {"locked": 0, "polarity": "ACTIVE_HIGH", "ignore_valid_char": 0, "baud_rate": "BAUD_9600", "leap_seconds": 0, "diagnostics": {"decoding": {"utc_decoded_count": 0, "date_decoded_count": 0, "not_valid_count": 0, "last_read_message": ""}, "io_checks": {"start_char_count": 0, "char_count": 0, "bit_count": 1, "bit_count_unfiltered": 0}}}}}
To confirm the setting:
rover@agx:~$ http http://169.254.102.121/api/v1/system/time/ptp
HTTP/1.1 200 OK
content-length: 1316
content-type: application/json
{
"current_data_set": {
"mean_path_delay": 18274.0,
"offset_from_master": -120738.0,
"steps_removed": 1
},
"parent_data_set": {
"gm_clock_accuracy": 254,
"gm_clock_class": 248,
"gm_offset_scaled_log_variance": 65535,
"grandmaster_identity": "48b02d.fffe.4d9dc9",
"grandmaster_priority1": 128,
"grandmaster_priority2": 128,
"observed_parent_clock_phase_change_rate": 2147483647,
"observed_parent_offset_scaled_log_variance": 65535,
"parent_port_identity": "48b02d.fffe.4d9dc9-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.00331d-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.0,
"gm_identity": "48b02d.fffe.4d9dc9",
"gm_present": true,
"gm_time_base_indicator": 0,
"ingress_time": 1650520841230826941,
"last_gm_phase_change": "0x0000'0000000000000000.0000",
"master_offset": -120738,
"scaled_last_gm_phase_change": 0
}
}
本文介绍了如何在Linux系统上检查硬件支持,启用Precision Time Protocol (PTP) 服务,并通过网络命令配置Ouster Lidar的时间戳模式和IP地址,以确保精确的时间同步。
229

被折叠的 条评论
为什么被折叠?



