Closed XYvven closed 4 years ago
Hi @Dunkem In the RealSense Viewer, you can find manual exposure controls for the depth and infrared streams by expanding open the Controls section of the Stereo Module section of the Viewer's options side-panel. Changing the exposure value will automatically turn off auto-exposure.
You can re-enable the Stereo Module's auto-exposure at any time by left-clicking on the box beside the Enable Auto Exposure option to turn the box from black (off) to blue (on).
You can likewise find the color exposure controls by expanding open the Controls section of the RGB Camera settings in the side-panel.
Once the streams have been enabled then making changes to the exposure settings will update the exposure of images in the center panel of the Viewer in real-time.
In ROS, exposure can be changed in real-time whilst the stream is active by using a feature called dynamic reconfigure, which is also known as rqt-reconfigure.
https://github.com/IntelRealSense/realsense-ros#set-camera-controls-using-dynamic-reconfigure-params
An example instruction for setting dynamic reconfigure with a D435 is:
rosrun dynamic_reconfigure dynparam set $realsense2_camera rs435_depth_exposure 200
rosrun instructions should be run after the roslaunch instruction.
thanks for your reply, but I set in realsense viewer and then close realsense viewer, run roslaunch realsense_camera rs_camera.launch, it looks like the config about exposure doesn't work. As what you reply I guess when I change the config info in realsense viewer but it doesn't write in camera. So for my application the only way for me to change the exposure mode is rqt_reconfigure?
The RealSense Viewer and the ROS wrapper are separate systems. Changes that you make to one will not affect the other. So if you are using ROS, you should change exposure during runtime with rqt-reconfigure.
ok, I misunderstand it. But I run ROS wapper by ssh which does contain a GUI desktop, it means I can't use rqt_reconfure. So if there exists another way for me to change the exposure mode and exposure value. thanks
Setting the exposure manually in ROS with a 400 Series camera before streaming seems to be more complicated than doing it with rqt_reconfigure. Apparently it can be done with a Python node script though. Here is an example:
rospy.set_param('/camera/realsense_ros_camera_manager/rs435_color_exposure', 1000)
So you mean it can't support by c++?
I have heard of people using C++ node scripts with RealSense ROS. I will see if I can find a C++ equivalent to the above instruction.
ok, thank you for your reply
Having looked at the subject, I believe that creating a C++ ROS script to change exposure may be so hard that it might be far easier to set the exposure with a camera configuration file called a json that can be called from the launch file.
https://github.com/IntelRealSense/realsense-ros/issues/411#issuecomment-477463559
You can create a custom json file easily by configuring values in the RealSense Viewer and then using a json export option on the toolbar on top of the options side-panel. I believe that doing it this way only saves the exposure settings within the Stereo Module options though.
I do what you told me, but I get error when I run roslaunch realsense2_camera rs_camera.launch
Please tell me what you did to get this error.
{ "aux-param-autoexposure-setpoint": "1536", "aux-param-colorcorrection1": "0.298828", "aux-param-colorcorrection10": "-0", "aux-param-colorcorrection11": "-0", "aux-param-colorcorrection12": "-0", "aux-param-colorcorrection2": "0.293945", "aux-param-colorcorrection3": "0.293945", "aux-param-colorcorrection4": "0.114258", "aux-param-colorcorrection5": "-0", "aux-param-colorcorrection6": "-0", "aux-param-colorcorrection7": "-0", "aux-param-colorcorrection8": "-0", "aux-param-colorcorrection9": "-0", "aux-param-depthclampmax": "65536", "aux-param-depthclampmin": "0", "aux-param-disparityshift": "0", "controls-autoexposure-auto": "True", "controls-autoexposure-manual": "8500", "controls-color-autoexposure-auto": "True", "controls-color-autoexposure-manual": "166", "controls-color-backlight-compensation": "0", "controls-color-brightness": "0", "controls-color-contrast": "50", "controls-color-gain": "64", "controls-color-gamma": "300", "controls-color-hue": "0", "controls-color-power-line-frequency": "3", "controls-color-saturation": "64", "controls-color-sharpness": "50", "controls-color-white-balance-auto": "True", "controls-color-white-balance-manual": "4600", "controls-depth-gain": "16", "controls-laserpower": "0", "controls-laserstate": "on", "ignoreSAD": "0", "param-autoexposure-setpoint": "1536", "param-censusenablereg-udiameter": "9", "param-censusenablereg-vdiameter": "9", "param-censususize": "9", "param-censusvsize": "9", "param-depthclampmax": "65536", "param-depthclampmin": "0", "param-depthunits": "1000", "param-disableraucolor": "0", "param-disablesadcolor": "0", "param-disablesadnormalize": "0", "param-disablesloleftcolor": "0", "param-disableslorightcolor": "0", "param-disparitymode": "0", "param-disparityshift": "0", "param-lambdaad": "800", "param-lambdacensus": "26", "param-leftrightthreshold": "24", "param-maxscorethreshb": "2047", "param-medianthreshold": "500", "param-minscorethresha": "1", "param-neighborthresh": "7", "param-raumine": "1", "param-rauminn": "1", "param-rauminnssum": "3", "param-raumins": "1", "param-rauminw": "1", "param-rauminwesum": "3", "param-regioncolorthresholdb": "0.0499022", "param-regioncolorthresholdg": "0.0499022", "param-regioncolorthresholdr": "0.0499022", "param-regionshrinku": "3", "param-regionshrinkv": "1", "param-robbinsmonrodecrement": "10", "param-robbinsmonroincrement": "10", "param-rsmdiffthreshold": "4", "param-rsmrauslodiffthreshold": "1", "param-rsmremovethreshold": "0.375", "param-scanlineedgetaub": "72", "param-scanlineedgetaug": "72", "param-scanlineedgetaur": "72", "param-scanlinep1": "60", "param-scanlinep1onediscon": "105", "param-scanlinep1twodiscon": "70", "param-scanlinep2": "342", "param-scanlinep2onediscon": "190", "param-scanlinep2twodiscon": "130", "param-secondpeakdelta": "325", "param-texturecountthresh": "0", "param-texturedifferencethresh": "0", "param-usersm": "1", "param-zunits": "1000", "stream-fps": "30", "stream-height": "720", "stream-ir-format": "R8L8", "stream-width": "1280" } this is the json file which I save from realsense viewer
I debug it and find it throw this error at adv.load_json(json_file_content);
You can set the json path by adding it onto the end of the launch instruction instead of putting the path in the json file itself. For example:
roslaunch realsense2_camera rs_camera.launch json_file_path:=/path/to/config/DefaultPreset_viewer.json`
I do this but I get the same error
Research of the set_pu(id=4) failed error suggests that it may occur because of a problem in the json file, such as a problem with loading it or a corruption. What was the json_file_path command that you used in the launch instruction, please?
realsense2_camera rs_camera.launch json_file_path:=/path/test.json this is the way I load json file, and the detail info about this file is put above!
I have been over the information carefully but cannot see where the problem is occurring. I will ask the ROS wrapper developer.
@doronhi Can you see why @Dunkem might be having difficulty calling on the json file from the launch statement above, please? Thanks!
Hi @Dunkem Do you still require assistance with this case, please?
I find another method that meets my needs, but it isn't a long-term solution. If there have an alternate will be better
Re-reading the whole case, I note that the reason that you could not use rqt_reconfigure to change exposure was that you did not have a display due to using SSH. Would it be possible to set the exposure with a rosparam text instruction in the command prompt? Like the one below:
rosparam set /camera/realsense_ros_camera_manager/rs435_color_exposure 1000
now I use this method, but this maybe not the best way to solve my case. Because every time I run my project, I will type this command in my terminal.
I did some further research and found information for setting ROS params with a C++ node or the launch file.
C++ void:ros::param::set(parameter_name, input_value)
From launch file
<param name="param-name" value="param-value" />
http://www.clearpathrobotics.com/assets/guides/kinetic/ros/ROS%20Parameter%20Server.html
in my case, I use rqt_reconfigure through multi-master. So it's ok for display
OK, I will try this way, thank you for your help
You are very welcome. Let us know how your tests go, please :)
it can work in my project, thanks for your help!!!
Awesome news - thanks so much for the update about your success :)
Issue Description
I want to set the infra and color exposure(and I set it in realsense viewer),but it looks like not work. So can you tell me how to set the exposure value by realsense viewer or by launch file(I didn't find any info about exposure in rs_camera.launch)