Ask Your Question

Basler camera detected randomly in ROS

asked 2017-07-05 17:16:43 -0600

Dasa gravatar image


I am trying to work with 4 Basler cameras (ac A640-120gm) and ROS and unfortunately when I launch pylon_camera_node.launch ROS connect with a random camera instead of the camera I ask in the config YAML file

Let's say I am working with 4 cameras with the following IDs: "Sun", "Moon", "Earth" & "Mars" (assigned to the cameras via IpConfigurator). When I try to connect to "Sun", I will use roslaunch to call its own launch file, but ROS instead of connect to "Sun" it will connect to another camera (for example "Moon" ) Message in ROS:

[ INFO] [1499291312.687715871]: No Device User ID set -> Will open the camera device found first
[ INFO] [1499291312.943262562]: Found camera with DeviceUserID Moon: acA640-120gm

The launch file in pylon_camera/launch has the following values:

<<?xml version="1.0"?>
<arg name="respawn" default="false" />
<arg name="debug" default="false" />
<arg name="node_name" default="pylon_camera_node" />
<arg name="config_file" default="$(find pylon_camera)/config/default_camSun.yaml" />

<arg unless="$(arg debug)" name="launch_prefix" value="" />
<arg     if="$(arg debug)" name="launch_prefix" value="gdb -ex run --args" />

<node name="$(arg node_name)" pkg="pylon_camera" type="pylon_camera_node" output="screen"
      respawn="$(arg respawn)" launch-prefix="$(arg launch_prefix)">
    <param name="camera_frame" value="$(arg node_name)" type="string" />
<param name="camera_info_url" value="file:///Path_to_/.ros/camera_info/Sun.yaml" type="string" />
    <rosparam command="load" file="/Path_to_/.ros/camera_info/Sun.yaml" />


The YAML file default_camSun.yaml (located in pylon_camera/config) has the following values

 camera_frame: camera
 device_user_id: "Sun"
 camera_info_url: "/Path_to_/.ros/camera_info/sun.yaml"
 image_encoding: "mono8"
 frame_rate: 5.0

I can understand ROS choose a camera randomly if I have the value device_user_id with an empty value, but I am specifying to work with the camera "Sun". And the camera is OK because sometime ROS choose the "Sun" camera in its random selection. How is it possible? device_user_id need to be filled in another format?

Thank you in advance for your help.

edit retag flag offensive close merge delete



Your launch file is confused- camera_info_url appears as a param in the launch file and the camSun yaml file, and the arg config_file is being ignored in favor of hard coding a location in the rosparam command load.

Try using rosparam get on the command line to see if device_user_id was set right.

lucasw gravatar image lucasw  ( 2017-07-05 19:31:58 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-05 19:34:26 -0600

lucasw gravatar image

updated 2017-07-05 19:36:05 -0600

Change the rosparam load file parameter back to

<rosparam command="load" file="$(arg config_file)" />

like it was in the pylon_camera_node.launch and delete the camera_info_url param line.

edit flag offensive delete link more


Thank you Lucasw! It works perfect now! But why it wasn't working before? It was not redundant information?

Dasa gravatar image Dasa  ( 2017-07-06 12:33:52 -0600 )edit

You had Sun.yaml getting loaded for the pylon camera parameters instead of default_camSun.yaml

lucasw gravatar image lucasw  ( 2017-07-06 12:43:00 -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

1 follower


Asked: 2017-07-05 17:16:43 -0600

Seen: 212 times

Last updated: Jul 05 '17