[ntp:questions] Sync system time with pixhawk autopilot

Mike Cook michael.cook at sfr.fr
Fri Nov 4 08:22:24 UTC 2016


> Le 4 nov. 2016 à 02:33, Jason Beach <jason.m.beach at gmail.com> a écrit :
> 
> I am working on a multicopter that is flown by a pixhawk autopilot and also
> a Jetson TK1 running Ubuntu (both onboard the vehicle). I am trying to
> figure out how best to synchronize the time between the two boards. The
> pixhawk has a GPS that it uses for navigation and also to set the autopilot
> system time (the pixhawk runs an RTOS called nuttx).  Communication between
> the pixhawk and Jetson is via a serial port using a protocol called
> mavlink.  It's fairly straightforward to determine the time offset between
> the two boards using a ptp-ish type algorithm--i.e. the Jetson timestamps a
> mavlink timesync packet, sends it to the autopilot which timestamps it and
> sends it back.  The Jetson records the time the timesync packet is received
> and using the three timestamps, calculates the offset (this all occurs on a
> custom interface written in C++).

Assuming that you are doing your maths right, you are doing what NTP does in a client/server dialogue and so can directly correct the system clock using adjtime(2) system call. The time correction is slow so that the two platform times need to be close before going into the loop. You probably need to jam sync the Jetson system time from an initial time sync exchange if that is not already done. 

> 
> The problem is how do I feed that offset to ntp so that it can correct the
> Jetson time or use it to adjust the Jetson system time outright? I know
> enough about ntp to get it to sync to computers together using fudge and
> that's about it.  Any advice is appreciated.
> 
> Thanks,
> Jason
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions

"The power of accurate observation is commonly called cynicism by those who have not got it. »
George Bernard Shaw



More information about the questions mailing list