ROS learning 12-NVIDIA JETSON TX2 uses turtlebot3 gazebo to simulate a simulation robot
In this section, we will use turtlebot3 to build a simulated robot and environment, here is based on the melodic version in ROS1.
First install the turtlebot3 series package
sudo apt install ros-melodic-turtlebot3*
slam (gmapping is used here)
sudo apt install ros-melodic-gmapping
navigation
sudo apt install ros-melodic-navigation
After the installation is successful, start emulating
turtlrbot3, autonomous positioning, mapping and local planning,
open a terminal and start ros master
roscore
Note: When opening a new terminal and running turtlebot3 related packages, the terminal needs to specify the bot type: that is, to open the terminal, you need to execute:
export TURTLEBOT3_MODEL=burger
, which means you open a terminal and enter the following commands every time. Of course, you can write it in ~/.bashrc if it is too troublesome File
export TURTLEBOT3_MODEL=burger
Start the turtlebot3 gazebo simulation environment,
then open a terminal and enter roslaunch turtlebot3_gazebo, double-click the tab, and find a bunch of gazebo model running files, just choose a test
roslaunch turtlebot3_gazebo turtlebot3_world.launch
Turtlebot3 and the simulation environment are displayed in gazebo. The
above command will start the gazebo model and a small robot. This robot is the black car under the nine white dots.
Start rviz to display radar data
. Choose one of the following methods. If it’s too much trouble, choose 1. I want to know about rviz Use option 2
1) Open the written rviz configuration file directly:
roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch
2) Configure rviz yourself
- Enter rviz in the terminal to open the rviz interface
- Change the fixed frame under the global option to odom, because the current map coordinates are not created, the map coordinates will be created when the slam is executed
- Click add below, add laserscan, set topic to scan, the radar point cloud will be displayed in the interface, the default point cloud is relatively small, you can increase the size value, such as 0.05, the point cloud data will become larger and clearer.
- Click add, add tf, multiple coordinate systems are displayed, click frame to remove the other coordinate systems except base_link and odom
You can see the faint radar point cloud.
Turn on the keyboard control of turtlebot3
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
Press waxd and other buttons to observe whether the movement of base_link in rviz is consistent. You
will find that the position of the small robot in gazebo will change.
Run gmapping
rosrun gmapping slam_gmapping
Add map under rviz, select topic/map, rviz displays slam to create a map. At
this time, use the keyboard control of turtlebot3 opened earlier to see that the map is slowly rendered.
Under the open button control terminal, press the waxds button to observe the slam The transformation of the created map
Turn off the keyboard control of
turtlebot3 Turn on move_base
roslaunch turtlebot3_navigation move_base.launch
Add path in rviz, select global path for topic and
click 2d nav_goal. On the map displayed by rviz, click with the mouse to select a target point. The robot will plan the path by itself and run to the target point.
Finally, the newly configured rviz can be saved so that it will not be used again next time For
the maps saved one by one by add topic , see the blog
reference link below:
https://blog.csdn.net/weixin_41469272/article/details/106139306