Timestamp Syncronization with Offboard Control

Is it possible to syncronize the clocks of the Pixhawk and an offboard computer (using Pixhawk as primary since it’s connected to GPS)? Right now I’m using Copter firmware and have to perform an IMU sync event to line up data from the pixhawk and that generated by the offboard computer (Jetson TK1). I am considering moving to the PX4 flight stack for a number of reasons and I’m curious if this issue could possibly be resolved as well.

1 Like

You need to run mavros, which is a part of ROS, on your companion computer. Synchronization is handled by sys_time plugin and works well.

Is that the only way? There are a couple reasons I do not want to use mavros.

So I dug into the sys_time plugin to see what it’s doing and it’s actually pretty simple. It uses the mavlink TIMESYNC message to calculate round trip time and offset (essentially what PTP does, but without transparent clocks, etc). So good info @tommises. Thanks!

How do I use sys_time plugin? I did not find any reference for it. I am using Ubuntu 16.04 and ROS kinetic installed from Repository with PX4 firmware. Any help will be appreciated

How do you synchronize the timestamp?
I have mavros broadcast a tf by changing the in “px4_config.yaml” local_position: send: false->true
The issue is that the timestamp is wrong.
How can I change the time_ref_source in mavros for SITL and companion computer?
By default time_ref_source: “fcu” in “px4_config.yaml”.
Should I use localhost / IP?

I was getting “[lpe] mocap timeout” messages all the time
What I did to fix that was to re-stamp every message received from Vicon (in my case) before forwarding those to PX4 (using mavros)

msg is of type “geometry_msgs.msg.TransformStamped”
Then I re-stamped every message using the time of the companion PC (Odroid, Raspberry, etc…)

msg_nwu.header.stamp = rospy.Time.now()