I am looking for a way to access the actual GPS time through a MAVLINK message. I was hoping that GPS_RAW_INT message would have it in the time_usec field, but I'm getting values like  :  1911873000 , which is the microseconds since boot.

Is the absolute GPS based timestamp available in another MAVLINK message or is there a way to configure the APM 2 using the ArduCopter 3.1RC1 release to populate the time_usec with GPS time rather than time since boot?

Thanks!

Rob

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Thanks for the  reply!

    Having a GPS-based timestamp for every message would be great, but  I don't see that timestamp defined in the Mavlink message definition:

    http://qgroundcontrol.org/mavlink/start#packet_anatomy

    nor do I see it defined in the MAVLINK messages:

    https://pixhawk.ethz.ch/mavlink/#GPS_RAW_INT

    (This is the one where the time since boot is used rather than absolute time)

    I'm doing this in Java starting with code from here:

    https://github.com/geeksville/arduleader/tree/master/mavjava

    I'll take a look at the Python library, but my guess is that it is pulling the GPS timestamp from some other source than the message.

    Where would the timestamp be defined in the MAVLINK message given the above definition?

  • Each Mavlink packet has a timestamp derived from the GPS (in UTC time), rather than a field in Mavlink itself.

    If you're using python, you can be the timestamps (using the Mavlink libraries):

    def process_file(filename):
        '''process one file'''
        print("Processing %s" % filename)
        mlog = mavutil.mavlink_connection(filename, notimestamps=opts.notimestamps)
        vars = {}
        
        while True:
            msg = mlog.recv_match(opts.condition)
            if msg is None: break
            tdays = (msg._timestamp - time.timezone) / (24 * 60 * 60)
            tdays += 719163 # pylab wants it since 0001-01-01
            add_data(tdays, msg, mlog.messages)

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…