Ask Your Question
0

stereo with two webcams

asked 2017-10-26 04:19:50 -0600

zahra.kh gravatar image

updated 2017-10-26 04:24:16 -0600

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

edit retag flag offensive close merge delete

Comments

1

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

FrozenCh gravatar imageFrozenCh ( 2017-10-26 04:58:45 -0600 )edit

how can i check video_device.?

zahra.kh gravatar imagezahra.kh ( 2017-10-26 06:57:33 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-10-26 05:39:28 -0600

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.

edit flag offensive delete link more

Comments

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

zahra.kh gravatar imagezahra.kh ( 2017-10-26 05:54:03 -0600 )edit

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

gvdhoorn gravatar imagegvdhoorn ( 2017-10-26 05:55:24 -0600 )edit

how can i use udev for webcams?

zahra.kh gravatar imagezahra.kh ( 2017-10-26 06:18:10 -0600 )edit

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

zahra.kh gravatar imagezahra.kh ( 2017-10-26 07:12:52 -0600 )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 imagegvdhoorn ( 2017-10-26 07:15:20 -0600 )edit
1

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

gvdhoorn gravatar imagegvdhoorn ( 2017-10-26 07:16:07 -0600 )edit

thanks stefan

zahra.kh gravatar imagezahra.kh ( 2017-10-27 01:10:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-10-26 04:19:50 -0600

Seen: 513 times

Last updated: Oct 26 '17