First time here? Check out the FAQ!


ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

stereo with two webcams

asked Oct 26 '17

zahra.kh gravatar image

updated Oct 26 '17

gvdhoorn gravatar image

hi all, i have two webcams and want run these at same time. i use usb_cam package and mylaunch is this:

<launch>
 <group ns="camera1">
  <node name="usb_cam1" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video1" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="mjpeg" />
    <param name="camera_frame_id" value="yuyv" />
    <param name="io_method" value="mmap"/>
  </node>
  <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/camera1/usb_cam1/image_raw"/>
    <param name="autosize" value="true" />
  </node>
 </group>

<group ns="camera2">
  <node name="usb_cam2" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video2" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="mjpeg" />
    <param name="camera_frame_id" value="yuyv" />
    <param name="io_method" value="mmap"/>
  </node>
  <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/camera2/usb_cam2/image_raw"/>
    <param name="autosize" value="true" />
  </node>
 </group>
</launch>

but when roslaunch my launch file, one webcam run and others is off and instead that the webcam from laptop is on! what is problem?! please help me

Preview: (hide)

Comments

1

check your video_device. I guess that there are three devices and one of them belongs to your laptop cam.

FrozenCh gravatar image FrozenCh  ( Oct 26 '17 )edit

how can i check video_device.?

zahra.kh gravatar image zahra.kh  ( Oct 26 '17 )edit

1 Answer

Sort by » oldest newest most voted
0

answered Oct 26 '17

In Linux, video devices are per default named /dev/videoX with X counting up. The order might change depending on multiple factors (for instance when the device was plugged in, already at boot or afterwards). The right way to work around this is using udev rules. To quote the Debian Wiki on udev:

udev allows for rules that specify what name is given to a device, regardless of which port it is plugged into. For example, a rule to always mount a hard drive with manufacturer "iRiver" and device code "ABC" as /dev/iriver is possible. This consistent naming of devices guarantees that scripts dependent on a specific device's existence will not be broken.

If you search for "udev webcam" you should find lots of information about how to setup udev rules for your webcams. Your rules should look somewhat similar to this:

SUBSYSTEM=="video4linux", BUS=="usb", ATTRS{vendor}=="0x046d", ATTRS{device}=="0x0807", NAME="webcam_left"
SUBSYSTEM=="video4linux", BUS=="usb", ATTRS{vendor}=="0x046d", ATTRS{device}=="0x0808", NAME="webcam_right"

You would then use /dev/webcam_left and /dev/webcam_right in your launch file.

Preview: (hide)

Comments

i am new in ros , and i don't know how can i use udev?!

zahra.kh gravatar image zahra.kh  ( Oct 26 '17 )edit

udev is a Linux (OS) subsystem, it is not something provided by ROS.

gvdhoorn gravatar image gvdhoorn  ( Oct 26 '17 )edit

how can i use udev for webcams?

zahra.kh gravatar image zahra.kh  ( Oct 26 '17 )edit

i am new in linux and i don't know how can i use udev?! please help me

zahra.kh gravatar image zahra.kh  ( Oct 26 '17 )edit
1

First: please don't badger us. We're all volunteers here and are helping you for free.

Second: udev is not part of ROS, so please use a more appropriate (ie: Linux oriented) support forum for that. @Stefan Kohlbrecher has already linked you to relevant docs on the Debian wiki. If things are ..

gvdhoorn gravatar image gvdhoorn  ( Oct 26 '17 )edit
1

.. still unclear, ask a question on askubuntu or one of the Ubuntu forums (provided you are using Ubuntu).

gvdhoorn gravatar image gvdhoorn  ( Oct 26 '17 )edit

thanks stefan

zahra.kh gravatar image zahra.kh  ( Oct 27 '17 )edit

Question Tools

2 followers

Stats

Asked: Oct 26 '17

Seen: 979 times

Last updated: Oct 26 '17