dronekit-python

GPS Timestamp with Dronekit-python API


I'm currently using the Dronekit-python API with MAVProxy to log attitude from a Pixhawk on an onboard computer running Linux. These measurements need to be integrated with external data for image processing, and I'm hoping to use a GPS timestamp for synchronization.

The time of interest is time_utc in MAVLink message #63 (GLOBAL_POSITION_INT_COV), as documented here, and I was unable to find any GPS timestamp parameter listed in the DroneKit-Python API Reference.

I'd appreciate any suggestions on retrieving the timestamp.


Solution

  • With dronekit_python, you can set up listeners for different mavlink messages. An approach you could take, then, is to set up a listener either for #63 GLOBAL_POSITION_INT_COV or another mavlink message which has system time. See this question for an example.

    There's also documentation for the different mavlink messages and their contents. According to the documentation, many messages have time since boot, but I believe that some of these are mis-documented. For example, I've seen #33 GLOBAL_POSITION_INT contain gps time, not time since boot. Just make sure you know the message structure and do a sanity check on the messages that you're receiving.