Basler cameras are displayed on two (multiple) devices under ros

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:

Basler pylon-ros-camera driver Xavier AGX debugging record (Arm architecture)_MendozaG's blog-CSDN blog The driver's x86 architecture can be started normally according to the manual and github instructions. Check the cloned driver, check the files in it and find no linked library (x86 and arm library are not shared), then you can try to install it. As a reminder, you can use the following command to view the properties of the library readelf -h xxxxx.so Since Xavier AGX with armv8 architecture is used, the steps are different from those in the manual. Follow the general steps first: drive github address: https://github.com/basler/pylon-ros-camera/tree/master/pylon_ca https://blog.csdn.net/m0_46611008/article/details/123804337? spm=1001.2014.3001.5501 We only need to modify the configuration file and launch file

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

Guess you like

Origin blog.csdn.net/m0_46611008/article/details/124049232
Recommended