[Documentation] [TitleIndex] [WordIndex

Note: This tutorial assumes that you have completed the previous tutorials: Creating a PSENscan application package, How to configure parameters with yaml.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Launching multiple scanners

Description: This tutorial explains how to use multiple scanners.

Keywords: PSENscan, psen_scan

Tutorial Level: BEGINNER

This part will teach you how to start multiple scanners with a single launchfile, by showing an example of how to launch two scanners simultaneously.

psen_scan/Multiple_Scanners_Tutorial_Architecture.png

Creating the config files

Navigate to your config folder:

roscd psen_scan_tutorials/config

We will reuse the first config-file from the previous tutorial and create a second config-file:

gedit config2.yaml

Fill the yaml-file with key: value pairs that match the parameters you would like to store. Here ́s an example:

password: "ac0d68d033"
sensor_ip: "192.168.0.20"
host_ip: "192.168.0.25"
host_udp_port: 50505
frame_id: "scanner2"

Note: You cannot assign adjacent IP-Adresses to different Scanners, e.g. 192.168.0.10 and 192.168.0.11, because a single scanner takes up two IP-Adresses.

Note: If all your scanners send data to the same host, they have to send to different host_udp_ports to avoid conflicts.

Note: You need to choose unique frame_ids for each scanner to be able to position them independently from one another inside your ROS-Environment.

Creating the launch file

Create a new launch-file inside your launch directory

roscd psen_scan_tutorials/launch
gedit two_scanners.launch

Here ́s an example launch-file:

<launch>
  <node name="laser_scanner" type="psen_scan_node" pkg="psen_scan" output="screen" required="true">
    <rosparam command="load" file="$(find psen_scan_tutorials)/config/config.yaml" />
  </node>
  <node name="laser_scanner2" type="psen_scan_node" pkg="psen_scan" output="screen" required="true">
    <rosparam command="load" file="$(find psen_scan_tutorials)/config/config2.yaml" />
  </node>
  <node name="rviz" type="rviz" pkg="rviz" args="-d $(find psen_scan)/config/config.rviz" />
</launch>

Note: Each laserscanner needs a unique node name.

Start the application

Enter the following to start RVIZ together with the ROS-Node for the PSENscan application.

roslaunch psen_scan_tutorials two_scanners.launch

Rviz will only show a single scanner. To add a second scanner to the visualization you need to add a LaserScanner Object to Rviz and then choose "laser_scanner2/scan" as it's topic.


2020-01-25 13:01