In mobile robotics, it is very important to know where the obstacles are, the outline of a room, and so on. Robots use maps to navigate and move across unknown spaces. The sensor used for these purposes is LIDAR. This sensor is used to measure distances between the robot and objects.
In this section, you will learn how to use a low-cost version of LIDAR that is widely used in robotics. This sensor is the Hokuyo URG-04lx rangefinder. You can obtain more information about it at http://www.hokuyo-aut.jp/. The Hokuyo rangefinder is a device used to navigate and build maps in real time:
The Hokuyo URG-04lx model is a low-cost rangefinder commonly used in robotics. It has a very good resolution and is very easy to use. To start with, we are going to install the drivers for the laser:
$ sudo apt-get install ros-kinetic-hokuyo-node $ rosstack profile && rospack profile
Once installed, we are going to check whether everything is OK. Connect your laser and check whether the system can detect it and whether it is configured correctly:
$ ls -l /dev/ttyACM0
When the laser is connected, the system sees it, so the result of the preceding command line is the following output:
crw-rw---- 1 root dialout 166, 0 Jan 13 11:09 /dev/ttyACM0
In our case, we need to reconfigure the laser device to give ROS the access to use it; that is, we need to give the appropriate permissions:
$ sudo chmod a+rw /dev/ttyACM0
Check the reconfiguration with the following command line:
$ ls -l /dev/ttyACM0 crw-rw-rw- 1 root dialout 166, 0 Jan 13 11:09 /dev/ttyACM0
Once everything is OK, we are going to switch on the laser. Start roscore in one shell, and in another shell, execute the following command:
$ rosrun hokuyo_node hokuyo_node
If everything is fine, you will see the following output:
[ INFO] [1358076340.184643618]: Connected to device with ID: H1000484