2
Tutorial : Using the Hector SLAM The F1/10 Team Introduction This tutorial will cover the installation of hector slam package and running a demo file to generate the map from a rosbag containing laser scans. You might use the self created ros bags or request one from us. Transcript to the Video Tutorial In the video lecture, we discussed the concepts behind simultaneous localization and mapping. Lets see how to implement th same in ROS. We will be using a package called hector slam. Use the command you see on the screen to install the hector slam package. I am not running the command here as its already installed on the system. sudo apt -get install ros -indigo -hector -slam Once the package is installed, we need to make some minor tweaks in the launch file. Go to the source folder for the installed package. roscd hector slam launch/launch/ Look up the launch file by name tutorial. You can ignore the other launch files you see on the screen as they have been created for test purposes. Open the launch file in a text editor with super user permissions. sudo gedit tutorial.launch Lets go through the code here. The parameter sim time suggests the rosmaster to use simulated time stamps when running the launch file. We will run the bagged laser data on simulated time stamps and hence we set this parameter as true. However when using the raw laser data to build the map, you should set this parameter as false. These lines launch the rviz with some default configurations. The mapping default launch file loaded here is the place where we set parameters for the hector algorithm. The hector slam package generates the transform between map and base frame, however we need transforms between world and map frame; and the base frame and laser frame. A static transform publisher package as shown here, serves this purpose. Thats all for the editing. Lets generate the map. First, run the roscore. We will play the rosbag with –clock argument as we will be using the simulated time stamps. Run the tutorial launch file. roscore rosbag play Lecture3SLAM Tutorial . bag --clock roslaunch hector slam launch tutorial.launch The map may or may not work as perfect as visible here. You might have to play around with certain parameters we talked about during the lecture. You can go through the mapping default launch file to get an indepth idea of various parameters. 1

Tutorial : Using the Hector SLAM - f1tenth.orgf1tenth.org/lab_instructions/W3_T1_Using the Hector SLAM.pdf · Tutorial : Using the Hector SLAM The F1/10 Team Introduction This tutorial

  • Upload
    lyhuong

  • View
    226

  • Download
    6

Embed Size (px)

Citation preview

Page 1: Tutorial : Using the Hector SLAM - f1tenth.orgf1tenth.org/lab_instructions/W3_T1_Using the Hector SLAM.pdf · Tutorial : Using the Hector SLAM The F1/10 Team Introduction This tutorial

Tutorial : Using the Hector SLAM

The F1/10 Team

IntroductionThis tutorial will cover the installation of hector slam package and running a demo file to generate the map

from a rosbag containing laser scans. You might use the self created ros bags or request one from us.

Transcript to the Video TutorialIn the video lecture, we discussed the concepts behind simultaneous localization and mapping. Lets see how

to implement th same in ROS. We will be using a package called hector slam. Use the command you see onthe screen to install the hector slam package. I am not running the command here as its already installed onthe system.

sudo apt−get i n s t a l l ros−ind igo−hector−slam

Once the package is installed, we need to make some minor tweaks in the launch file. Go to the sourcefolder for the installed package.

roscd hec to r s l am launch / launch/

Look up the launch file by name tutorial. You can ignore the other launch files you see on the screen asthey have been created for test purposes. Open the launch file in a text editor with super user permissions.

sudo ged i t t u t o r i a l . launch

Lets go through the code here. The parameter sim time suggests the rosmaster to use simulated time stampswhen running the launch file. We will run the bagged laser data on simulated time stamps and hence we setthis parameter as true. However when using the raw laser data to build the map, you should set this parameteras false.

These lines launch the rviz with some default configurations. The mapping default launch file loaded here isthe place where we set parameters for the hector algorithm. The hector slam package generates the transformbetween map and base frame, however we need transforms between world and map frame; and the base frameand laser frame. A static transform publisher package as shown here, serves this purpose.

Thats all for the editing. Lets generate the map.First, run the roscore. We will play the rosbag with –clock argument as we will be using the simulated timestamps. Run the tutorial launch file.

r o s c o r erosbag play Lecture3SLAM Tutorial . bag −−c l o ckros launch hec to r s l am launch t u t o r i a l . launch

The map may or may not work as perfect as visible here. You might have to play around with certainparameters we talked about during the lecture. You can go through the mapping default launch file to get anindepth idea of various parameters.

1

Page 2: Tutorial : Using the Hector SLAM - f1tenth.orgf1tenth.org/lab_instructions/W3_T1_Using the Hector SLAM.pdf · Tutorial : Using the Hector SLAM The F1/10 Team Introduction This tutorial

roscd hector mapping / launchsudo ged i t mapping default . launch

As you can see here, we have parameters to set the various frames, set the resolution, number of grids tobe used by the optimization algorithm, and several map update parameters which can create a heavy impacton the map quality. To read more on this, and a few more parameters follow the ROS wiki page for the hectormapping package. Also don’t forget to save the map using the map server.

rosrun map server map saver −f mymap

References• Hector Mapping ROS Wiki : http://wiki.ros.org/hector_mapping

• Github link to Launch file.

2