Skip to content
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

Closed
bentank opened this issue Dec 18, 2018 · 6 comments
Closed

Need GetSensorTime API #2922

bentank opened this issue Dec 18, 2018 · 6 comments

Comments

@bentank
Copy link
Contributor

bentank commented Dec 18, 2018

Required Info  
Camera Model D435
Firmware Version 05.09.14.00
Operating System & Version Win 10
Platform PC
SDK Version 2.11.1

This is a follow up to the closed issue in #2188.

Please provide a reasonable response without just closing out the issue.

Thanks!

@dorodnic
Copy link
Contributor

Hi @bentank
Sorry, the original issue should not have been closed. Thanks for raising this up again.
I will check the status and update tomorrow.

@bentank
Copy link
Contributor Author

bentank commented Dec 18, 2018

@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!

@dorodnic
Copy link
Contributor

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
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
Closing it for now. Please reopen if the issue was not addressed.

@dorodnic
Copy link
Contributor

dorodnic commented May 8, 2019

@bentank - #3909 is the follow-up on this request, if you are interested.

@dorodnic
Copy link
Contributor

dorodnic commented Jun 3, 2019

With "Global Time" part of the 2.22 release and working well, I think it's safe to close this one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants