Skip to content

Power on UVC sensors after creation to speed initialization - #12897

Merged
Nir-Az merged 1 commit into
realsenseai:developmentfrom
OhadMeir:development
May 9, 2024
Merged

Power on UVC sensors after creation to speed initialization#12897
Nir-Az merged 1 commit into
realsenseai:developmentfrom
OhadMeir:development

Conversation

@OhadMeir

@OhadMeir OhadMeir commented May 5, 2024

Copy link
Copy Markdown
Contributor

At initialization phase there are many HWM and other commands that need the sensor to be in powered on (D0) state.
Keeping it on for a short time instead of turning it on and off (D3) can speed up the initialization.

Testing with a D500 device it reduced pipeline time to first frame by an average of 90 milliseconds.

@OhadMeir
OhadMeir requested a review from Nir-Az May 5, 2024 19:21
Comment thread src/uvc-sensor.h
{
std::this_thread::sleep_for( timeout );
if( auto strong = weak.lock() )
strong->release_power();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure release_power(); cannot throw.
Even if today it can't might be better to wrap with try/catch as an exception here will crash the application

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

release_power catches set_power_state exceptions.
Theoretically there might be an exception from locking a mutex, but I don't think we need to guard against it. If locking a mutex fails here will probably be the least of our problems.

@Nir-Az
Nir-Az merged commit cac91e2 into realsenseai:development May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants