Note: This tutorial assumes that you have completed the previous tutorials: How to set up a Pilz PSENscan laser scanner with Ethernet.
(!) 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.

How to set up ROS to communicate with the scanner

Description: You learn how to set up the PILZ laser scanner with ROS and show the result in Rviz.

Keywords: PSENscan, psen_scan

Tutorial Level: BEGINNER

Next Tutorial: Launching multiple scanners

WARNING

THE PILZ SOFTWARE IS PROVIDED AS-IS AND WITH NO WARRANTY (FOR MORE DETAILS SEE LICENSE).

Introduction

This tutorial teaches you to set up and launch the ROS driver for the PSENscan laser scanner. This includes creating a new ROS package to read and display laser scanner data.

Prerequisites

In order to complete this tutorial, you need the following:

Create a ROS package with the required files

Install the psen_scan package as in the previous tutorials described.

In your workspace, create a new package:

cd ~/catkin_ws/src
catkin_create_pkg --rosdistro melodic psen_scan_tutorials psen_scan
cd psen_scan_tutorials
mkdir config
gedit config/scanner_config.yaml

Copy the following content and paste it into gedit. Do not forget to save the new created file.

Could not fetch external code from 'https://raw.githubusercontent.com/PilzDE/pilz_tutorials/master/psen_scan_tutorials/config/scanner_config.yaml':

Like in the last step create the file psen_scan_tutorials/launch/psen_scan.launch with the following content by using gedit:

mkdir launch
gedit launch/psen_scan.launch

Could not fetch external code from 'https://raw.githubusercontent.com/PilzDE/pilz_tutorials/master/psen_scan_tutorials/launch/psen_scan.launch':

The code explained:

Could not fetch external code from 'https://raw.githubusercontent.com/PilzDE/pilz_tutorials/master/psen_scan_tutorials/launch/psen_scan.launch':

This starts the psen_scan_node and loads the newly created config file.

Could not fetch external code from 'https://raw.githubusercontent.com/PilzDE/pilz_tutorials/master/psen_scan_tutorials/launch/psen_scan.launch':

This starts rviz with a predefined configuration.

Required parameters

To launch the ROS driver, the following parameters are mandatory:

  • password

    The password is required to establish communication with the scanner. The password has to be encrypted. The default encrypted value is ac0d68d033.

  • sensor_ip The IP of the laser scanner in the network. You have configured this in the first tutorial using the configuration tool.

  • host_ip

    The IP under which the scanner can reach your PC and will send UDP packages to. It needs to be in the same subnet as the aforementioned sensor_ip. We suggest setting this IP statically for the appropriate network interface.

  • host_udp_port

    Similar to the host_ip this is used for the scanner to reach your PC. It needs to be accessible by the scanner, so make sure it is not blocked by a firewall and the scanner can reach it.

For an overview of all parameters, please visit https://github.com/PilzDE/psen_scan/blob/melodic-devel/README.md#ros-api

Start the PSENscan application

Now you can launch your newly created launchfile with the following command:

roslaunch psen_scan_tutorials psen_scan.launch

  • Make sure your PC operates in the same IP subnet like the laser scanner.
  • Make sure to set the IP addresses according the parameters above. The previous tutorial showed how these could be altered.

This should launch rviz and look something like this:

rviz2.png

The red lines show the detected surroundings of the scanner.

For comparison in reality the scanner was placed in an arrangement more or less like this:

reality2.png

Conclusion

In this tutorial you created a basis for an application using the PSENscan laser scanner together with ROS. In the next tutorial you learn how to connect to multiple scanners.

Wiki: psen_scan/Tutorials/ConfiguringPsenScanParametersWithYaml (last edited 2020-07-13 13:25:56 by ChristianDoehn)