0
$\begingroup$

Rosanswers logo

Greetings.

I'm trying to use 2 iDS ucam USB cameras for stereo vision, but when I'm trying to use both of them with camera_calibration cameracalibrator.py it shows a little window with "display" captition and freezes:

$ rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 right:=/stereo/right/image_raw left:=/stereo/left/image_raw right_camera:=/stereo/right left_camera:=/stereo/left
('Waiting for service', '/stereo/left/set_camera_info', '...')
OK
('Waiting for service', '/stereo/right/set_camera_info', '...')
OK
init done

rostopic shows that I still do have cameras ready to transmit images

$ rostopic list
/image /rosout /rosout_agg
/stereo/left/camera_info
/stereo/left/image_raw
/stereo/left/image_raw/compressed
/stereo/left/image_raw/compressed/parameter_descriptions
/stereo/left/image_raw/compressed/parameter_updates
/stereo/left/image_raw/compressedDepth
/stereo/left/image_raw/compressedDepth/parameter_descriptions
/stereo/left/image_raw/compressedDepth/parameter_updates
/stereo/left/image_raw/theora
/stereo/left/image_raw/theora/parameter_descriptions
/stereo/left/image_raw/theora/parameter_updates
/stereo/left/timeout_count
/stereo/nodelet_manager1/bond
/stereo/nodelet_manager2/bond
/stereo/right/camera_info
/stereo/right/image_raw
/stereo/right/image_raw/compressed
/stereo/right/image_raw/compressed/parameter_descriptions
/stereo/right/image_raw/compressed/parameter_updates
/stereo/right/image_raw/compressedDepth
/stereo/right/image_raw/compressedDepth/parameter_descriptions
/stereo/right/image_raw/compressedDepth/parameter_updates
/stereo/right/image_raw/theora
/stereo/right/image_raw/theora/parameter_descriptions
/stereo/right/image_raw/theora/parameter_updates
/stereo/right/timeout_count
/stereo/ueye_cam_nodelet1/parameter_descriptions
/stereo/ueye_cam_nodelet1/parameter_updates
/stereo/ueye_cam_nodelet2/parameter_descriptions
/stereo/ueye_cam_nodelet2/parameter_updates

rqt_graph shows that cameras are connected to cameracalibrator
rqt_graph screesnsot

To use ucam cameras I'm using ueye_cam node, installed as described here: http://wiki.ros.org/ueye_cam
To initialize cameras I'm using modified rgb8.launch script from ueye_cam distribution:

<launch>
    <group ns="stereo">
        <node name="check_ueye_api" pkg="ueye_cam" type="check_ueye_api" required="true" />
        <node name="nodelet_manager1" pkg="nodelet" type="nodelet"  args="manager" output="screen" />
        <node name="nodelet_manager2" pkg="nodelet" type="nodelet"  args="manager" output="screen" />

        <node pkg="nodelet" type="nodelet" name="ueye_cam_nodelet1"
                args="load ueye_cam/ueye_cam_nodelet nodelet_manager1" output="screen">
                
            <param name="camera_name" type="str" value="right" /> <!-- == namespace for topics and services -->
            <param name="camera_topic" type="str" value="image_raw" />
            <param name="camera_id" type="int" value="0" /> <!-- 0 = any camera; 1+: camera ID -->
            <param name="camera_intrinsics_file" type="string" value="" /> <!-- default: ~/.ros/camera_info/<camera_name>.yaml -->
            <param name="camera_parameters_file" type="string" value="" /> <!-- default: ~/.ros/camera_conf/<camera_name>.ini -->
            <param name="ext_trigger_mode" type="bool" value="False" /> <!-- if False, then camera will operate in free-run mode; otherwise, frames need to be triggered by hardware signal (falling-edge) on digital input pin of camera -->

            <!-- the following are optional camera configuration parameters:
                 they will be loaded on the camera after the .ini configuration
                 file, and before dynamic_reconfigure. That means that any
                 (lingering) dynamic parameters from dynamic_reconfigure will
                 override these values, and that these will override parameters
                 from the .ini file.
                 See http://www.ros.org/wiki/ueye_cam for more details. -->

            <param name="color_mode" type="str" value="rgb8" /> <!-- valid options: 'rgb8', 'mono8', 'bayer_rggb8' -->

            <!-- WARNING: the following 4 parameters specify dimensions for camera's area of interest. Values for image_width and image_height that are smaller than your camera's maximum values will result in cropped field of view. For typical cases, one should modify values for sensor_scaling / binning / subsampling to downsample the resulting ROS image to the desired dimensions, without losing potential field of view. -->
            <param name="image_width" type="int" value="640" />
            <param name="image_height" type="int" value="480" />
            <param name="image_top" type="int" value="-1" /> <!-- -1: center -->
            <param name="image_left" type="int" value="-1" /> <!-- -1: center -->

            <param name="subsampling" type="int" value="1" /> <!-- supported by only some UEye cameras -->
            <param name="binning" type="int" value="1" /> <!-- supported by only some UEye cameras -->
            <param name="sensor_scaling" type="double" value="1.0" /> <!-- supported by only some UEye cameras -->

            <param name="auto_gain" type="bool" value="True" />
            <param name="master_gain" type="int" value="0" />
            <param name="red_gain" type="int" value="0" />
            <param name="green_gain" type="int" value="1" />
            <param name="blue_gain" type="int" value="16" />
            <param name="gain_boost" type="bool" value="False" />

            <param name="auto_exposure" type="bool" value="True" />
            <param name="exposure" type="int" value="33" /> <!-- in ms -->

            <param name="auto_white_balance" type="bool" value="True" />
            <param name="white_balance_red_offset" type="int" value="0" />
            <param name="white_balance_blue_offset" type="int" value="0" />

            <param name="flash_delay" type="int" value="0" /> <!-- in us -->
            <param name="flash_duration" type="int" value="1000" /> <!-- in us -->

            <param name="auto_frame_rate" type="bool" value="False" />
            <param name="frame_rate" type="double" value="30.0" />
            <param name="output_rate" type="double" value="0.0" /> <!-- >0: throttle rate for publishing frames -->
            <param name="pixel_clock" type="int" value="25" />

            <param name="flip_upd" type="bool" value="False" />
            <param name="flip_lr"  type="bool" value="False" />
        </node>

    <!-- ======================================================================================= -->

        <node pkg="nodelet" type="nodelet" name="ueye_cam_nodelet2"
                args="load ueye_cam/ueye_cam_nodelet nodelet_manager2" output="screen">
            <param name="camera_name" type="str" value="left" /> <!-- == namespace for topics and services -->
            <param name="camera_topic" type="str" value="image_raw" />
            <param name="camera_id" type="int" value="0" /> <!-- 0 = any camera; 1+: camera ID -->
            <param name="camera_intrinsics_file" type="string" value="" /> <!-- default: ~/.ros/camera_info/<camera_name>.yaml -->
            <param name="camera_parameters_file" type="string" value="" /> <!-- default: ~/.ros/camera_conf/<camera_name>.ini -->

            <param name="ext_trigger_mode" type="bool" value="False" /> <!-- if False, then camera will operate in free-run mode; otherwise, frames need to be triggered by hardware signal (falling-edge) on digital input pin of camera -->

            <!-- the following are optional camera configuration parameters:
                 they will be loaded on the camera after the .ini configuration
                 file, and before dynamic_reconfigure. That means that any
                 (lingering) dynamic parameters from dynamic_reconfigure will
                 override these values, and that these will override parameters
                 from the .ini file.
                 See http://www.ros.org/wiki/ueye_cam for more details. -->

            <param name="color_mode" type="str" value="rgb8" /> <!-- valid options: 'rgb8', 'mono8', 'bayer_rggb8' -->

            <!-- WARNING: the following 4 parameters specify dimensions for camera's area of interest. Values for image_width and image_height that are smaller than your camera's maximum values will result in cropped field of view. For typical cases, one should modify values for sensor_scaling / binning / subsampling to downsample the resulting ROS image to the desired dimensions, without losing potential field of view. -->
            <param name="image_width" type="int" value="640" />
            <param name="image_height" type="int" value="480" />
            <param name="image_top" type="int" value="-1" /> <!-- -1: center -->
            <param name="image_left" type="int" value="-1" /> <!-- -1: center -->

            <param name="subsampling" type="int" value="1" /> <!-- supported by only some UEye cameras -->
            <param name="binning" type="int" value="1" /> <!-- supported by only some UEye cameras -->
            <param name="sensor_scaling" type="double" value="1.0" /> <!-- supported by only some UEye cameras -->

            <param name="auto_gain" type="bool" value="True" />
            <param name="master_gain" type="int" value="0" />
            <param name="red_gain" type="int" value="0" />
            <param name="green_gain" type="int" value="1" />
            <param name="blue_gain" type="int" value="16" />
            <param name="gain_boost" type="bool" value="False" />

            <param name="auto_exposure" type="bool" value="True" />
            <param name="exposure" type="int" value="33" /> <!-- in ms -->

            <param name="auto_white_balance" type="bool" value="True" />
            <param name="white_balance_red_offset" type="int" value="0" />
            <param name="white_balance_blue_offset" type="int" value="0" />

            <param name="flash_delay" type="int" value="0" /> <!-- in us -->
            <param name="flash_duration" type="int" value="1000" /> <!-- in us -->

            <param name="auto_frame_rate" type="bool" value="False" />
            <param name="frame_rate" type="double" value="30.0" />
            <param name="output_rate" type="double" value="0.0" /> <!-- >0: throttle rate for publishing frames -->
            <param name="pixel_clock" type="int" value="25" />

            <param name="flip_upd" type="bool" value="False" />
            <param name="flip_lr"  type="bool" value="False" />
        </node>
    </group>
</launch>

The script seems to work because there are no error messages in roslaunch launch/rgb8_both.launch output and I can easily get image from cam 1 OR 2 (but not 1 AND 2) (rosrun camera_calibration cameracalibrator.py --size 9x7 --square 0.024 image:=/stereo/left/image_raw camera:=/stereo/left and mono-stuff like that work fine)

What can be the problem? I know for sure that the image from 2 cameras can be transmitted in the same time and my PC (and USB 3.0) will deal with it because I did some image processing in OpenCV using both cameras in the same time.


Originally posted by SamanthaTraynor65 on ROS Answers with karma: 16 on 2017-11-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Sorry for late response, wasn't sure if my question was published.
I found the reason and now it works. Turned out that all of it was happening because cameras were not synchronized. Adding --approximate key fixed that.
So now I use this command: rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.024 --approximate=0.01 right:=/stereo/right/image_raw left:=/stereo/left/image_raw right_camera:=/stereo/right left_camera:=/stereo/left


Originally posted by SamanthaTraynor65 with karma: 16 on 2017-12-03

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.