-
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
Need GetSensorTime API #2922
Comments
Hi @bentank |
@dorodnic, thanks for the update. Please let me know if I can assist with more information regarding the issue and purposed solution. It is greatly appreciated! |
Hi @bentank Good news! While there is no such "official" command in firmware, you can read the value off the relevant register directly, and this works on production units (on NDA hardware you could also write registers, but this is blocked on production units for obvious reasons) Basically, you can use the following code snippet to get current firmware time: using namespace rs2;
pipeline p;
auto prof = p.start();
auto dev = prof.get_device().as<debug_protocol>();
uint8_t data[]{
0x14, 00, 0xab, 0xcd, 01, 00, 00, 00, 0x3c, 0x61, 01, 00, 0x40, 0x61, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00
};
std::vector<uint8_t> command(data, data + sizeof(data));
auto res = dev.send_and_receive_raw_data(command);
auto ptr = reinterpret_cast<uint32_t*>(res.data());
auto ts = ptr[1] * 0.001;
std::cout << ts << std::endl; There is a concern of how much time such query can take. In theory it goes through the entire UVC driver stack, and can be bounced by the firmware several times (because it relies on an asynchronous UVC extension unit), but in practice I'm getting a result within ~1ms. This should be good enough for any practical purpose. |
[Realsense Customer Engineering Team Comment] |
With "Global Time" part of the 2.22 release and working well, I think it's safe to close this one :) |
This is a follow up to the closed issue in #2188.
Please provide a reasonable response without just closing out the issue.
Thanks!
The text was updated successfully, but these errors were encountered: