Getting real timestamp in Python
evfinkn opened this issue · 4 comments
Hello,
Is there anyway to get the UTC timestamp of a record (or even just an Aria VRS file) in the Python bindings? I know that Aria VRS has a time domain stream (285-1), but I can't find anything about it in the docs. Is there a reason it isn't mentioned?
Hi,
You are right we have an opportunity to enhance this documentation on Aria Timestamp.
As you notice, the API allows you to retrieve a timestamp for every data piece you are getting from the VRS Stream.
But the UTC value is provided natively only for the GPS stream
Else we prefer our user to always use the native time domain of the VRS stream (timestamp_ns
).
I assume that you want a better documentation to convert the timestamp to a real clock to get the TIME (i.e. 4PM:02s) at which an image has been taken, or do you want something different?
Yeah, that's what I'd like. Specifically, I have some data—including a time—from a survey taken during a recording and wasn't sure if there's any way to find in the recording when the survey was taken.
Hello @evfinkn
Here some more information about what is doable:
- VRS is registering when a recording has started as a tag -> let's call it
vrs_recording_time
- VRS Stream data can be relative to this timing above ->
(vrs_record_time - vrs_stream_start) + vrs_recording_time
will provide what you want
How to retrieve when a VRS file has been captured?
- as today you can use VRS binary (assuming you have it compiled)
# taking as example the file we are sharing here https://github.com/facebookresearch/projectaria_tools/blob/main/data/mps_sample/sample.vrs
% ./build/tools/vrs/vrs sample.vrs | grep capture_time_epoch
Tag: capture_time_epoch = 1686767221 -- Wed Jun 14 11:27:01 2023 PDT
As you see this recording started on Wed Jun 14 11:27:01 2023 PDT
How to compute the relative timestamp for a given VRS record?
- using projectaria_tools API
first_time = provider.get_first_time_ns(stream_id, TimeDomain.DEVICE_TIME)
For your given recording, substract this value and then add the value from the vrs file
Adding the functionality to the real time API would make sense, let us know if you want to try to help to mockup this as contribution to the library ;-)
@evfinkn Can you close the issue, or do you want keep it open?