-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timestamp for time received time (backend_time?), how to access source #6300
Comments
I believe that the instruction frame.get_timestamp() returns the timestamp of the frame, in milliseconds since the device was started. The discussion in the link below may be useful. In it, @ev-mp provides explanations of the types of timestamp and provides a reply to someone who was seeking to query the timestamp system to correlate it with their host system. I would think (not certain) that timestamps would be handled by the file ds5-timestamp.cpp: https://github.com/IntelRealSense/librealsense/blob/master/src/ds5/ds5-timestamp.cpp |
Hi @timprepscius |
Ok, I'm reading through your code which pertains to time. I'm looking where the frame_object is constructed. in v4l2 I see: in mf-uvc I see: I haven't found the rsusb version yet. Why are you using realtime instead of monotonic? I need to change you to monotonic. Will I be breaking anything? I wish that instead of monotonic_to_realtime you had:
your rs2_get_time goes to environment time which goes to a realtime clock. This is what I think I'm seeing. I am going to experiment with changing:
|
Backend timestamp is backend (OS) specific. I don't think there is specific reason for each implementation, but we also do not guaranty backend timestamp API will be consistent between backends. I'm open to changing how backend timestamp is generated. @ev-mp? |
Having backend and host time use the same EPOCH is useful to profile kernel->user space transition bottlenecks. W.r.t
So I think that introducing this attribute via metadata route is quite straight-forward. Extending the API is more complicated, imho. |
Maybe I can provide a little bit more detail of my use case: This originated with a strategy to synchronize kinectsV2 on multiple machines. I have put in logging of when your (realsense) os_time_service is queried, and what timestamp arrives on a frame, and it seems as though the frame timestamp is in fact the first timestamp, which is good. Both the Kinect and the Realsense provide a timestamp originating in their device. This is probably driven by the usb clock driving the polling (atleast the kinect seemed to be). The USB clock has noticeable skew from the PC clock. And each computer I buy has different changing skew rates. This meant that Kinect Device timestamp was not just an "offset" of the PC timestamp. And of course, each PC timestamp was not just an offset of another PC timestamp. You all already know all of this though. I found it really surprising when I first started figuring out how much skew there really was. To overcome all these skew problems, I make time_received be a monotonic time. I then maintain a (sample windowed) linear-regression between the [Realsense/Kinect]DeviceTime -> the ReceivedTime(LibraryHostSteadyClock). Given these equations, I can, mostly, given a [Realsense/Kinect]DeviceTime on any computer, provide a master clock time, with specificity better than 1/90th of a second. In my situation, I would like for your library to:
I have not done #3, because I have so many other things to do at the moment. Done babbling- hope this is of use. |
@timprepscius As a follow-up, I have added the 'Enhancement' (feature request) label to this case to reflect the 3 feature requests that you made in your last comment above, Thanks! |
Hi @timprepscius As changes to rs-frame.hpp **were merged into the SDK in late May, I will close this case now. Thanks for your wish-list! |
Despite this issue being closed, this issue has not otherwise been resolved, as far as I can tell. The OP above showed their own custom patches to the library to add some of the missing features. This does not mean the feature has been implemented, or is available to others. I suggest that either this issue is reopened or a new one is created, to track the availability of a monotonic timestamp on each frame and getter to compare against. |
Hey there again,
For whatever reason, I need to access the time generator which is used to mark a frame's arrival. Is this considered the backend_time? I need to ask this same timestamp generator to generate a new timestamp at my choosing. I use this to quantify error in your system and measure clock skews.
Could you tell me a line number for where the timestamp is generated?
Also, can you confirm that you are marking receive time when the first packet from the usb has arrived, and not when the last packet arrives?
Thanks
The text was updated successfully, but these errors were encountered: