In many cases we need to use multiple cameras, so how should we configure them?
Analogous to the display of two little turtles in turtlesim (turtle1 and turtle2), recommended reading: A gentle introduction to ros;
We know that we only need to create two namespaces.
For how to configure Basler on ROS, you can check:
In the above path, make two copies of default.yaml and name them as above.
Open two yaml files and set the id of the device (note that the id needs to be set manually)
device_id setting method (the latest version has changed the cpp document of write-xxxxxxxx, and the node name has also changed):
The above method is not intuitive and can be directly assigned through pylon's IP configure
Give 01 and 02 respectively (or other names you want, which need to be consistent with the .yaml file )
Next, change the launch file and modify pylon_camera_node.lauch to:
<?xml version="1.0"?>
<launch>
<arg name="respawn" default="false" />
<arg name="debug" default="false" />
<arg name="node_name" default="pylon_camera_node" />
<arg name="mtu_size" default="1500" />
<arg name="startup_user_set" default="CurrentSetting" />
<arg name="enable_status_publisher" default="true" />
<arg name="enable_current_params_publisher" default="true" />
<arg unless="$(arg debug)" name="launch_prefix" value="" />
<arg if="$(arg debug)" name="launch_prefix" value="gdb -ex run --args" />
<group ns ="01">
<arg name="config_file" default="$(find pylon_camera)/config/01.yaml" />
<node name="$(arg node_name)" pkg="pylon_camera" type="pylon_camera_node" output="screen"
respawn="$(arg respawn)" launch-prefix="$(arg launch_prefix)">
<rosparam command="load" file="$(arg config_file)" />
<param name="gige/mtu_size" value="$(arg mtu_size)"/>
<param name="startup_user_set" value="$(arg startup_user_set)"/>
<param name="enable_status_publisher" value="$(arg enable_status_publisher)"/>
<param name="enable_current_params_publisher" value="$(arg enable_current_params_publisher)"/>
</node>
</group>
<group ns ="02">
<arg name="config_file" default="$(find pylon_camera)/config/02.yaml" />
<node name="$(arg node_name)" pkg="pylon_camera" type="pylon_camera_node" output="screen"
respawn="$(arg respawn)" launch-prefix="$(arg launch_prefix)">
<rosparam command="load" file="$(arg config_file)" />
<param name="gige/mtu_size" value="$(arg mtu_size)"/>
<param name="startup_user_set" value="$(arg startup_user_set)"/>
<param name="enable_status_publisher" value="$(arg enable_status_publisher)"/>
<param name="enable_current_params_publisher" value="$(arg enable_current_params_publisher)"/>
</node>
</group>
</launch>
Two of the namespaces (ns) can be chosen at will, as long as they are different.
After modification, run the launch
roslaunch pylon_camera pylon_camera_node.launch
Select the topic to display in the image_view of rviz or rqt:
If it is not displayed, just add a set of tf transformations.
rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link pylon_camera 50