ros2与turtlebot3仿真教程-安装ros2
说明:
步骤:
简单步骤:
安装
sudo apt install ros-humble-ros-desktop
$ sudo apt install python3-colcon-common-extensions
$ sudo apt install ros-humble-cartographer
$ sudo apt install ros-humble-cartographer
$ sudo apt install ros-humble-cartographer-ros
$ sudo apt install ros-humble-navigation2
$ sudo apt install ros-humble-nav2-bringup
$ sudo apt install python3-vcstool
sudo apt install ros-humble-gazebo-ros*
ros2与turtlebot3仿真教程-安装turtlebot3
说明:
步骤:
$ mkdir -p ~/tb3_ws/src
$ cd ~/tb3_ws
#humble版本
$wget https://raw.githubusercontent.com/ROBOTIS-GIT/turtlebot3/humble-devel/turtlebot3.repos
$ vcs import src < turtlebot3.repos
$ colcon build --symlink-install
$ echo 'source ~/tb3_ws/install/setup.bash' >> ~/.bashrc
$ echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
$ source ~/.bashrc
ros2与turtlebot3仿真教程-启动gazebo不同环境
说明:
步骤:
cd ~/.gazebo/
git clone https://github.com/osrf/gazebo_models models
rm -rf models/.git
$ echo 'export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/tb3_ws/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models' >> ~/.bashrc
$ echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc
$ source ~/.bashrc
启动Fake Node
$ ros2 launch turtlebot3_fake_node turtlebot3_fake_node.launch.py
$ ros2 run turtlebot3_teleop teleop_keyboard
启动empty地图
$ ros2 launch turtlebot3_gazebo empty_world.launch.py
启动world地图
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
启动house地图
$ ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py
ros2与turtlebot3仿真教程-turtlebot3遥控
说明:
步骤:
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
$ ros2 run turtlebot3_teleop teleop_keyboard
ros2与turtlebot3仿真教程-turtlebot3自走避障
说明:
步骤:
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
$ ros2 run turtlebot3_gazebo turtlebot3_drive
ros2与turtlebot3仿真教程-rviz2模型显示
说明:
步骤:
$ ros2 launch turtlebot3_gazebo turtlebot3_house.launch.py
$ ros2 launch turtlebot3_bringup rviz2.launch.py
ros2与turtlebot3仿真教程-turtlebot3建图
说明:
步骤:
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
$ ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True
$ ros2 run turtlebot3_teleop teleop_keyboard
控制小车随机移动,并进行建图,并查看建立的地图,差不多后,保存地图。
效果如下:
$ ros2 run nav2_map_server map_saver_cli -f ~/map
ros2与turtlebot3仿真教程-turtlebot3导航
说明:
步骤:
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
$ ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=True map:=/home/ubuntu/map.yaml