Get timestamp of last received telemetry


I can read in Telemetry list url (Telemetry list - 7.2) Each section contains a circular buffer of timestamped samples provided by a producer.

How to get timestamp of last drone_controller telemetry for example ?
I saw in guidance/python/ that we can get self.tlm_dctl["position_local.x"] to get position_local, but how to know the associated timestamp of this info ?


Using self.tlm_dctl.get_timestamp() you get a telemetry.telemetry_binding.types.timespec object, with tv_sec for seconds and tv_nsec for nanoseconds.

Don’t know where is the doc of this … :man_shrugging:


Two methods are available:

get_ts whiche return a millisecond timestamp.
get_timstamp which returns a timespec structure.

It should be available at GitHub - Parrot-Developers/telemetry: Drone telemetry library and tools based on shared memory (libshdata) but has not been yet published with the python wrappers.


1 Like

For your information, it is also possible to specify a timestamp and a method for a fetch:

    def fetch_sample(self, timestamp=None, method=Method.Latest):
        """Get a new sample.

            timestamp (timespec): timestamp of query (can be None for LATEST
            method (int): method of query.

            bool: True if at least one sample has been read in one of the shared
                memory where variables are.


With the Method enumeration:

py::enum_<tlm_method>(telemetry, "Method")
	.value("Latest", TLM_LATEST)
	.value("Closest", TLM_CLOSEST)
	.value("FirstAfter", TLM_FIRST_AFTER)
	.value("FirstBefore", TLM_FIRST_BEFORE)
	.value("Oldest", TLM_OLDEST)
	.value("StrictlyAfter", TLM_STRICTLY_AFTER)
	.value("StrictlyBefore", TLM_STRICTLY_BEFORE);


Thank you @Ronan !
Can’t wait to see the doc published online !


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.