Getting started with laser SLAM from scratch (6) - ROS common toolbox

Hello everyone, I am a doctoral candidate in the direction of SLAM. I know the ups and downs of the SLAM learning process along the way, and I am very grateful to everyone for their high-quality articles and source code. With more and more knowledge, I am going to organize a column of my own laser SLAM study notes, from 0 to take everyone to quickly get started with laser SLAM, and it is also convenient for students who want to get started with SLAM and Xiaobai study reference, I believe you can read it There will be certain gains in the end. If there is something wrong, please point it out, and welcome everyone to exchange and discuss and make progress together.

There are many toolboxes provided in ROS, but we only have three most commonly used ones, two-dimensional RQT, three-dimensional RVIZ, and simulation Gazebo. Mastering these three is basically enough. The specific usage of these three toolboxes will be introduced in detail below.

1. RQT

The following shows the commonly used Rqt toolbox usage. For more usage, see the official website http://wiki.ros.org/rqt_common_plugins

  • rqt_graph
$ rosrun rqt_graph rqt_graph  #查看各ros节点之间的逻辑关系图

 

  • rqt_plot
$ rosrun rqt_plot rqt_plot  #rqt_plot命令可以在滚动时间图上显示发布到某个话题上的数据。

 

  • rqt_image_view
$ rqt_image_view  #查看图片话题。

 

  • rqt_tf_tree
$ rosrun rqt_tf_tree rqt_tf_tree  #查看坐标系之间的关系,TF树。

 

  • rqt_bag
$ rqt_image_view  #查看rosbag的数据,能够可视化图片和时间戳,并且可以选择话题进行发布,能够随时启动,暂停以及快进,但不能可视化三维消息。

 

2. RVIZ

2.1 Introduction

RVIZ is a powerful 3D visualization tool that is well compatible with various robot platforms based on the ROS software framework. Ability to visualize the vast majority of sensor data. rviz installation

sudo apt-get install rviz

Let's take a look at what effect RVIZ can achieve, and the specific code will be mentioned later.

2.2 Display point cloud

You can use Select to select the point cloud to obtain specific information

 

2.3 Display image

2.4 Display Odometry

2.5 Display IMU

2.6 Display boundingbox

Use jsk_recognition_msgs

 At the same time, RVIZ provides a marker interface. Users can display markers in RVIZ according to their own definitions. It can define the main types of markers as shown in the figure below.

2.7 display path

 

2.8 Display map

  • grid map

  • Point cloud map

 

  • Octree map

3.GAZEBO

3.1 Introduction

Gazebo in ROS is a widely used open source physics simulation engine, which can simulate various types of robots, vehicles, sensors, environments, etc., and can develop, test and verify robot control algorithms and sensor data processing algorithms in a simulation environment .

 Gazebo provides the following functions:

  1. Physical simulation: Gazebo uses a physical engine to simulate the movement and collision of objects, thereby providing real physical interaction and object movement effects.
  2. Sensor simulation: Gazebo can simulate various types of sensors, such as lidar, camera, IMU, GPS, etc., and can generate various types of sensor data for the development and testing of sensor data processing algorithms in a simulation environment.
  3. Environmental simulation: Gazebo can create complex 3D environments, including terrain, buildings, weather, etc., to simulate various scenarios in the real world.
  4. ROS integration: Gazebo can be integrated with ROS, so that users can control and communicate with the robot in Gazebo through ROS, making it more convenient for robot development and testing.

To sum up, Gazebo is a very powerful physical simulation engine that provides various functions to help developers develop, test and verify robots, and improve the stability and reliability of robot systems.

3.2 use

1. Install 

#安装
sudo apt-get install ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control
#下载模型
cd ~/.gazebo && wget https://gitee.com/ohhuo/scripts/raw/master/gazebo_model.py && python3 gazebo_model.pyCopy to clipboardErrorCopied
# 运行下载模型脚本
Python gazebo_model.py
# 打开gazebo导入相关模型

2. Build a simulation environment

The building editor option of Edit can quickly build the simulation environment, and can set the color and material. After the construction is completed, click the save world option of file to save the file format as world, which is convenient for later calling.

Turtlebot mobile robot gazebo simulation and navigation

#安装依赖
sudo apt-get install ros-noetic-joy ros-noetic-teleop-twist-joy ros-noetic-teleop-twist-keyboard ros-noetic-laser-proc ros-noetic-rgbd-launch ros-noetic-depthimage-to-laserscan ros-noetic-rosserial-arduino ros-noetic-rosserial-python ros-noetic-rosserial-server ros-noetic-rosserial-client ros-noetic-rosserial-msgs ros-noetic-amcl ros-noetic-map-server ros-noetic-move-base ros-noetic-urdf ros-noetic-xacro ros-noetic-compressed-image-transport ros-noetic-rqt-image-view ros-noetic-gmapping ros-noetic-navigation ros-noetic-interactive-marker
# 安装turtlebot3
mkdir turtlebot_ws/src/
cd turtlebot_ws/src/
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
cd ~/turtlebot_ws 
catkin_make 

a. Load the robot and map

First
change the world in the turtlebot_ws/src/turtlebot3_simulations/turtlebot3_gazebo/launch/turtlebot3_world.launch file to your own path.

<arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/baylands.world"/>
# 加载地图和机器人
export TURTLEBOT3_MODEL='burger'
roslaunch turtlebot3_gazebo turtlebot3_world.launch

 

b. The keyboard controls the movement of the robot

export TURTLEBOT3_MODEL='burger'
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

c. SLAM mapping

export TURTLEBOT3_MODEL='burger'
roslaunch turtlebot3_slam turtlebot3_slam.launch  #启动SLAM节点
# 利用键盘控制移动,注意鼠标点一下键盘控制的终端才会有效
rosrun map_server map_saver -f ~/workspace/turtlebot_ws/src/turtlebot3/turtlebot3_navigation/map   #保存地图

d. Navigation

 Only ensure that the simulated terminal is open, and other terminals can be closed.

export TURTLEBOT3_MODEL='burger'
roslaunch turtlebot3_navigation turtlebot3_navigation.launch 

Select the "2D Pose Estimate" on the rviz toolbar with the left mouse button to relocate the robot's position in the simulation environment to be consistent with that on the map, then select the "2D Nav Goal" option in the rviz toolbar, and long press the left mouse button to specify a position for the robot on the map. Navigation target point. After releasing the mouse, an optimal path is planned in a short time, and the robot starts to move towards the target point.

Thank you friends for reading this far. If you are unclear or wrong, welcome to discuss in the comment area. The blogger is also a beginner. Please explain according to your own understanding. Please understand. The next article will come soon~ Follow me if you like
it Let's go!

Guess you like

Origin blog.csdn.net/HUASHUDEYANJING/article/details/130036375