Open msadowski opened 5 years ago
Why don't you try serial
parameter to specify the serial number of the device? See Wiki and dynamic config.
In addition, I'm sure it is possible to specify device number corresponding to the serial number using udev settings.
@7675t thanks a lot for your feedback. I just came back to working on this!
I was just testing it a bit. Here is my launch file:
<launch>
<arg name="node_name" default="camera_elp_1" />
<arg name="frame_id" default="camera" />
<arg name="index" default="-1" />
<group ns="$(arg node_name)">
<node pkg="libuvc_camera" type="camera_node" name="elp_camera">
<!-- Set the frame id-->
<param name="frame_id" value="$(arg frame_id)" />
<param name="device" value="/dev/video3" />
<!-- Parameters used to find the camera -->
<param name="vendor" value="0x05a3"/>
<param name="product" value="0x9422"/>
<!-- <param name="serial" value="/dev/video2"/> -->
<!-- If the above parameters aren't unique, choose the first match: -->
<param name="index" value="$(arg index)"/>
<!-- Image size and type -->
<!-- 2592x1944, 1920,1080, 1600,1200, ... /-->
<param name="width" value="640"/>
<param name="height" value="480"/>
<!-- choose whichever uncompressed format the camera supports: -->
<param name="video_mode" value="mjpeg"/> <!-- or yuyv/nv12/mjpeg -->
<param name="frame_rate" value="15"/>
<param name="timestamp_method" value="start"/> <!-- start of frame -->
<param name="auto_exposure" value="3"/> <!-- use aperture_priority auto exposure -->
<!-- <param name="absolute_exposure" value="0"/> -->
<param name="auto_white_balance" value="true"/>
<param name="brightness" value="120"/>
<param name="contrast" value="160"/>
<param name="saturation" value="128"/>
</node>
</group>
</launch>
What I noticed is that if I don't add the serial parameter the node starts just fine. When I specify the serial as "/dev/video2", where my camera is the node dies with the error:
process[camera_elp_1/elp_camera-2]: started with pid [21267]
uvc_find_device: No such device (-4)
[camera_elp_1/elp_camera-2] process has died [pid 21267, exit code 255, cmd /opt/ros/melodic/lib/libuvc_camera/camera_node __name:=elp_camera __log:=/home/mat/.ros/log/63b391d0-8903-11e9-8754-a0c589a0e934/camera_elp_1-elp_camera-2.log].
log file: /home/mat/.ros/log/63b391d0-8903-11e9-8754-a0c589a0e934/camera_elp_1-elp_camera-2*.log
I tested the uvc_node with /dev/video2 and it worked just fine.
When running rqt_dynamic_reconfigure and selecting "elp_camera" the rqt_reconfigure dies with an error:
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/node_selector_widget.py", line 275, in _selection_changed_slot
self._selection_selected(index_current, rosnode_name_selected)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/node_selector_widget.py", line 225, in _selection_selected
item_widget = item_child.get_dynreconf_widget()
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/treenode_qstditem.py", line 154, in get_dynreconf_widget
self._param_name_raw)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/dynreconf_client_widget.py", line 90, in __init__
self.reconf.config_callback = self.config_callback
File "/opt/ros/melodic/lib/python2.7/dist-packages/dynamic_reconfigure/client.py", line 276, in set_config_callback
self._config_callback(self.config)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/dynreconf_client_widget.py", line 113, in config_callback
widget.update_value(config[widget.param_name])
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_reconfigure/param_editors.py", line 439, in update_value
self._update_signal.emit(self.values.index(value))
ValueError: -1732753462 is not in list
Aborted
I'll see if I can find a source of the error. If I make any discoveries I'm happy to update the docs!
'/dev/video2' is the name of the device file, not a serial number. You can check the serial number with lsusb command (iSerialNumber). Some USB device doesn't have it, so please check it.
@7675t I see, thanks for clarifying that! Unfortunately all the cameras that I have report the same serial number.
It seems to me that the only way forward is using a library that works directly with device files. Thanks for all the help!
@7675t a final question - maybe you will know the answer!
What exactly is the index parameter? and where is it coming from? I noticed that when I specify indices of 4 of my cameras to 0, 1, 2 and 3 I always access the same camera when launching all 4 of them.
I tried plugging the cameras in random order to the same USB ports and as long as I plug them to the same port the configuration seems consistent. If the index is by any chance tied to the serial device index in the system this would most probably solve all my problems!
Happy to update the docs to make this param function clearer if my suspicion is right!
Wiki says the index is the order number of devices which have same vid and pid. Code is here. I'm not sure the order is always same, sorry. But in my experience, if we plug the devices into same USB port at boot time, they are assigned to same bus and same port and assigned same device number in same order, so you may be able to use index.
And as I mentioned before, you may be able to use udev.rules to fix the device name corresponding to the port number etc. (Please search the way in the web). There is even a bit tricky way to use external program in udev.rules to identify the devices. https://www.clearpathrobotics.com/assets/guides/ros/Udev%20Rules.html
Good luck.
@msadowski have u got a workaround for this issue, im also facing the same problem connecting 2 identical camera
Unfortunately not really. As far as I remember I kept them as they were and they were always showing up in the same order.
On Mon 11. 1. 2021 at 0:11, ridhwankamil notifications@github.com wrote:
@msadowski https://github.com/msadowski have u got a workaround for this issue, im also facing the same problem connecting 2 identical camera
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ros-drivers/libuvc_ros/issues/60#issuecomment-757560836, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR5TFWT27DK7YRXU6ESC4LSZIXZBANCNFSM4HGG22AA .
In my case, usb camera devices which I always plug in ports in same order, are assigned to different indexes by libuvc each time I reboot robot's computer so this creates a mess in my workspace. I couldn't find other way than working with usb_cam package.
Hi!
I've been trying to figure out this one for quite a while now. I have 3 cameras (same manufacturer and model), when checking the settings the 3 parameters of vendor, product and serial are the same. The only way I can launch different cameras is by modifying the index parameter.
Is there any way I can have a control of the camera index? Ideally I would like to prefix my camera names according to the robot placement (forward, left, right). If the driver used the device path (/dev/video0 etc) then I would create a symlink based on the USB port the device is connected to.
Any tips how could I solve this particular problem? I know uvc_camera node can take a device path but I would prefer to stick with libuvc_ros if possible.