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

How to restore the options to default values? #10163

Closed
MyZQL opened this issue Jan 18, 2022 · 4 comments
Closed

How to restore the options to default values? #10163

MyZQL opened this issue Jan 18, 2022 · 4 comments

Comments

@MyZQL
Copy link

MyZQL commented Jan 18, 2022


Required Info
Camera Model D435
Firmware Version 05.13.00.50
Operating System & Version Linux (Ubuntu 20LTS)
Kernel Version (Linux Only) 5.11
Platform PC
SDK Version pyrealsense 2.50
Language python
Segment Others

Issue Description

How can I restore the options to default values via pyrealsense API after I change some of them such as:
color_sensor.set_option(rs.option.exposure, 1000)
color_sensor.set_option(rs.option.gain, 50)
......

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jan 18, 2022

Hi @ZhongQingliang You could set the defaults for the 400 Series cameras manually for specific options that you have changed. If you launch the RealSense Viewer program and examine the settings of the options without altering them, they are typically the default values of that camera model.

For example, the RGB defaults are 156 for exposure and 64 for gain.

Alternatively, you could try performing a reset of the camera using the hardware_reset() instruction. A simple example Python code snippet is shown below.

ctx = rs.context()
devices = ctx.query_devices()
for dev in devices:
dev.hardware_reset()

#8393 has an example of Python code that might be more suited to your application, where the reset is placed within a function that is called, so that you can activate the reset precisely when you need to by calling the function name.

@Nir-Az
Copy link
Collaborator

Nir-Az commented Jan 18, 2022

Hi @ZhongQingliang ,

Like @MartyG-RealSense said, hardware_reset() resets most of the option into their default values

If you want to set to default during runtime this should work:

option = rs.option.exposure
option_range = color_sensor.get_option_range(option)
value_to_set = option_range.default
color_sensor.set_option(option, value_to_set)

@MartyG-RealSense
Copy link
Collaborator

Hi @ZhongQingliang Do you require further assistance with this case, please? Thanks!

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no further comments received.

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