[Ubuntu20.04] From ROS-noetic installation to SLAM simulation of turtlebot3

SLAM simulation with ROS-noetic

I wanted to try SLAM, so I tried it as an entrance.

--Installation --Simulation execution


environment ubuntu 20.04


ROS installation

To install ROS-noetic quickly, I think you should use the shell of ROBOTIS.

python


$ git clone https://github.com/ROBOTIS-GIT/robotis_tools.git
$ cd robotis_tools
$ chmod 755 ./install_ros_noetic.sh
$ bash ./install_ros_noetic.sh

If you install it this way, it will be in ~ / .bashrc alias cw='cd ~/catkin_ws' alias cs='cd ~/catkin_ws/src' alias cm='cd ~/catkin_ws && catkin_make' Shortcuts are created for your convenience. I use cs and cm quite a lot.

Creating a workspace

If you install with the above shell, a workspace called catkin_ws will be created, so skip it. Anyone who installs it any other way will create a workspace, whatever the name (catkin_ws in this case) is.

python


$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
$ cd ~/catkin_ws && catkin_make

Creating a simulation environment for turtlebot3

Install the package by specifying branch as noetic-dev

python


$ git clone -b noetic-dev https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone -b noetic-dev https://github.com/ROBOTIS-GIT/turtlebot3.git
$ cd ~/catkin_ws && catkin_make

There are three types of turtlebot3, Burger, Waffle, and Waffle Pi, so you have to specify them. Any one is fine, but this time I will choose Burger.

I don't want to hit export TURTLEBOT3_MODEL = burger every time, so I write it to bashrc. (The editor is familiar)

python


$ gedit ~/.bashrc

On the last line

export TURTLEBOT3_MODEL=burger

Write, save and close.

python


$ source ~/.bashrc

It will be reflected in. (If TURTLEBOT3_MODEL gives an unknown error in the future, please do this again)

Installation of turtlebot3 simulator

python


$ cd ~/catkin_ws/src
$ git clone -b noetic-dev https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
$ cd ~/catkin_ws && catkin_make

Running the simulator [RViz]

python


$ roslaunch turtlebot3_fake turtlebot3_fake.launch

This will launch turtlebot3.

Screenshot from 2020-11-15 02-29-45.png

You will be able to operate the keyboard with the following command, please execute "in a new terminal".

python


$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Running the simulator [Gazebo]

Close all terminals and start a new one.

Next, run the simulation in Gazebo. RViz is a debugging tool, but Gazebo can simulate it in any environment.

Here, we will simulate in the space where the standard (?) Pole stands.

python


$ roslaunch turtlebot3_gazebo turtlebot3_world.launch

Various environments are available in (turtlebot3_simulations / turtlebot3_gazebo / launch /. Empty space >> turtlebot3_empty_world.launch Inside the house >> turtlebot3_house.launch)

Screenshot from 2020-11-15 02-49-06.png Screenshot from 2020-11-15 02-49-50.png

Next, avoid obstacles and let them control automatically

python


$ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch

If you look at gazebo with this, you can see that it is self-controlling.

At this time, if you start RViz, you can visualize how Turtlebot 3 is measuring the distance with a laser.

python


$ roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch

Screenshot from 2020-11-15 03-02-54.png


Finally SLAM simulation

Close all terminals and start a new one. SLAM performs self-position estimation and map generation at the same time.

Install the SLAM module.

python


$ sudo apt-get install ros-noetic-slam-gmapping

Then start Gazebo again.

python


$ roslaunch turtlebot3_gazebo turtlebot3_world.launch

Once Gazebo starts, run SLAM immediately.

python


$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping

Screenshot from 2020-11-15 03-11-56.png

This will start map generation.

To generate a map of this entire space, just run the non-collide program.

python


$ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch

If you leave it for a while, you can create a whole map.

Screenshot from 2020-11-15 03-31-06.png

I want to save the map once it is generated. First, install map server.

python


$ sudo apt-get install ros-noetic-map-server

Create the folder you want to save (maps in this case) and save it there.

python


$ mkdir ~/maps
$ cd ~/maps
$ rosrun map_server map_saver

If you get an error: you may have rosrun map_server map_server, the second time saver.

You can display the acquired map by opening map.pgm.

Screenshot from 2020-11-15 03-48-23.png


reference How to Launch the TurtleBot3 Simulation With ROS ["ROS Robot Programming Bible"](https://www.amazon.co.jp/ROS%E3%83%AD%E3%83%9C%E3%83%83%E3%83%88%E3%83 % 97% E3% 83% AD% E3% 82% B0% E3% 83% A9% E3% 83% 9F% E3% 83% B3% E3% 82% B0% E3% 83% 90% E3% 82% A4 % E3% 83% 96% E3% 83% AB-% E8% A1% A8-% E5% 85% 81% E3% 80% 93 / dp / 4274221962 / ref = cm_cr_arp_d_pl_foot_top? Ie = UTF8)

Recommended Posts

[Ubuntu20.04] From ROS-noetic installation to SLAM simulation of turtlebot3
Try switching from the RHEL environment to the Ubuntu environment Server installation
[Note] Flow from docker installation to JupyterLab startup on ubuntu
How to Burning a Install Disk of Windows from Ubuntu
Ubuntu Desktop upgrade from 18.0.4 (?) To 20.04.1 (focal)
From introduction to use of ActiveHash
From introduction to usage of byebug
I want to mess with Permission of Windows directory from WSL (ubuntu)
From pulling docker-image of rails to launching
Build Cakephp environment from docker installation Ubuntu
RDP connection from Windows 10 to Ubuntu Desktop 20.04
Fastest installation of Visual Studio Code on Ubuntu
Summary of moss when updating from JMockit 1.4 to 1.30
From setup to usage of Selenium wrapper Selenide
JDBC operation check from xampp installation on Ubuntu