ros-drivers / video_stream_opencv

A package to open video streams and publish them in ROS using the opencv videocapture mechanism
227 stars 159 forks source link

Dynamic Reconfiguration Does not Work #89

Closed samialperen closed 3 years ago

samialperen commented 3 years ago

I checked the cfg file for dynamic reconfiguration. However, when I run let's say

rosrun dynamic_reconfigure dynparam get /videofile/videofile_image_view

I get the following output:

{'max_image_value': 0.0, 'min_image_value': 0.0, 'do_dynamic_scaling': False, 'groups': {'colormap': -1, 'parent': 0, 'min_image_value': 0.0, 'groups': {}, 'id': 0, 'do_dynamic_scaling': False, 'name': 'Default', 'parameters': {}, 'max_image_value': 0.0, 'state': True, 'type': ''}, 'colormap': -1}

However, parameters you added to config file is totally different than these parameters. How can I change the parameters in config?

My goal is to play different videos (mp4) from ROS network. I managed to do that with roslaunch and changing video_stream_provider argument, but I want to do this dynamically.

awesomebytes commented 3 years ago

Hello @samialperen Note that you were querying the wrong dynamic reconfigure server, you were checking the one for 'image_view' not for video_stream_opencv

E.g. I get:

sam@aware:~/workspaces/video_stream_opencv$ rosrun dynamic_reconfigure dynparam list
/webcam/image_raw/compressed
/webcam/image_raw/compressedDepth
/webcam/image_raw/theora
/webcam/webcam_image_view
/webcam/webcam_stream
sam@aware:~/workspaces/video_stream_opencv$ rosrun dynamic_reconfigure dynparam get /webcam/webcam_stream{'loop_videofile': False, 'camera_info_url': '', 'stop_frame': -1, 'saturation': 0.64, 'height': 0, 'flip_vertical': False, 'width': 0, 'fps': 30.0, 'set_camera_fps': 30.0, 'contrast': 0.125490196078, 'hue': 0.5, 'auto_exposure': True, 'start_frame': 0, 'reopen_on_read_failure': False, 'buffer_queue_size': 1, 'frame_id': 'webcam_optical_frame', 'groups': {'camera_info_url': '', 'saturation': 0.64, 'loop_videofile': False, 'parent': 0, 'hue': 0.5, 'stop_frame': -1, 'reopen_on_read_failure': False, 'auto_exposure': True, 'buffer_queue_size': 1, 'frame_id': 'webcam_optical_frame', 'groups': {}, 'height': 0, 'id': 0, 'exposure': 0.5, 'output_encoding': 'bgr8', 'name': 'Default', 'parameters': {}, 'brightness': 0.501960784314, 'camera_name': 'webcam', 'start_frame': 0, 'flip_vertical': False, 'width': 0, 'state': True, 'flip_horizontal': False, 'fps': 30.0, 'set_camera_fps': 30.0, 'type': '', 'contrast': 0.125490196078}, 'exposure': 0.5, 'output_encoding': 'bgr8', 'brightness': 0.501960784314, 'camera_name': 'webcam', 'flip_horizontal': False}

Note that anyways we don't support changing the file on the fly. You could do a python script that uses subprocess to do that, for example.