3drobotics / solodevguide

Solo Development Guide (SDG).
http://dev.3dr.com/
41 stars 62 forks source link

MAVlink message time sychronization #317

Open alexblack opened 8 years ago

alexblack commented 8 years ago

I see that if you register to receive messages, such as Attitude, they include time_boot_ms. I'd like to be able to figure out how calculate at what time.time() (eg system time) a given time_boot_ms was at.

For example, if I receive an Attitude message at time_boot_ms=30630, how do I figure out how long ago that was?

alexblack commented 8 years ago

Looks like SYSTEM_TIME message might be useful for this:

SYSTEM_TIME {time_unix_usec : 1466397010705000, time_boot_ms : 19900}

    @self.on_message('SYSTEM_TIME')
    def listener(self, name, message):
      print message