< >
Home » ROS2版TurtleBot3入门教程_视频版 » TurtleBot3入门教程#ROS2版#-PC安装

TurtleBot3入门教程#ROS2版#-PC安装

文章说明

  • 本教程介绍如何在在PC上安装对应的系统和软件
  • 系统与ROS版本对应关系:
    • Ubuntu 20.04 - ROS1 Noetic and ROS2 Foxy
    • Ubuntu 22.04 - ROS2 Humble
  • 若当前手上使用的是创客智造提供的虚拟机则不需要进行以下的安装步骤

相关设备

安装步骤

系统安装
ROS2 安装
安装TurtleBot3及相关依赖包
  • [Remote PC] 安装相关依赖包
$ sudo apt install -y python3-argcomplete python3-colcon-common-extensions python3-vcstool git

# foxy版
$ sudo apt-get install ros-foxy-gazebo-* ros-foxy-cartographer ros-foxy-cartographer-ros \
  ros-foxy-nav2-bringup ros-foxy-navigation2 ros-foxy-slam-toolbox

# humble版
$ sudo apt-get install ros-humble-gazebo-* ros-humble-cartographer ros-humble-cartographer-ros \
  ros-humble-nav2-bringup ros-humble-navigation2 ros-humble-slam-toolbox
  • [Remote PC] 安装TurtleBot3包
$ sudo apt update
$ sudo apt install libudev-dev
$ mkdir -p ~/turtlebot3_ws2/src
$ cd ~/turtlebot3_ws2/src/

# foxy版
$ git clone -b foxy-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/DynamixelSDK.git
$ git clone -b foxy-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone -b foxy-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3.git
$ git clone -b foxy-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/hls_lfcd_lds_driver.git
$ git clone -b ros2-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/ld08_driver.git

# humble版    
$ git clone -b humble-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/DynamixelSDK.git
$ git clone -b humble-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone -b humble-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/turtlebot3.git
$ git clone -b humble-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/hls_lfcd_lds_driver.git
$ git clone -b ros2-devel https://ghproxy.com/https://github.com/ROBOTIS-GIT/ld08_driver.git

$ cd ~/turtlebot3_ws2
$ colcon build --symlink-install
$ echo 'source ~/turtlebot3_ws2/install/setup.bash' >> ~/.bashrc
$ source ~/.bashrc
  • [Remote PC] 环境配置
# 根据当前所使用的机型来配置当前TURTLEBOT3_MODEL
$ echo 'export TURTLEBOT3_MODEL=burger #burger or waffle_pi' >> ~/.bashrc

$ echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
$ source ~/.bashrc

虚拟机版本切换

  • 若测试用的ubuntu20.04虚拟机为创客智造提供的,默认的ros版本为Noetic。如果想要切换到Foxy环境,则需要进行环境切换
  • 若提供的为ubuntu22.04虚拟机则忽略当前步骤
  • [Remote PC] 若当前需要从Noetic切换到Foxy环境,需要将文档末端的两项环境变量全部注释,保存退出关闭此终端
$ vim ~/.bashrc
   
#source ~/tools/environment/noetic/setRosNoeticEnvironment.sh
#source ~/tools/environment/foxy/setRos2FoxyEnvironment.sh

$ exit
  • [Remote PC] 打开新终端,将文档末端Foxy的环境变量的注释标志去掉,再保存退出
$ vim ~/.bashrc
   
#source ~/tools/environment/noetic/setRosNoeticEnvironment.sh
source ~/tools/environment/foxy/setRos2FoxyEnvironment.sh

$ source ~/.bashrc && rosversion -d
foxy

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: none