Turtlebot3+ubuntu20.04+ROS noetic环境搭建
作者:互联网
使用turtlebot3 burger进行实验,PC机已经安装好了ubuntu20.04环境
PC端安装ROS noetic
参考官方文档http://wiki.ros.org/noetic/Installation/Ubuntu
- 安装源
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- 增加key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
- 更新
sudo apt update
- 安装
sudo apt install ros-noetic-desktop-full
- 环境设置
source /opt/ros/noetic/setup.bash
- 安装相关ROS依赖包
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-rosserial-arduino \
ros-noetic-rosserial-python 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* ros-noetic-rviz \
ros-noetic-gmapping ros-noetic-navigation ros-noetic-interactive-markers
- 安装turtlebot3软件包
sudo apt install ros-noetic-dynamixel-sdk
sudo apt install ros-noetic-turtlebot3-msgs
sudo apt install ros-noetic-turtlebot3
树莓派环境安装
-
去官方下载https://ubuntu-mate.org/download/arm64/focal/
-
使用SD Card Formatter格式化SD卡
-
使用Raspberry Pi Image导入ubuntu系统文件
-
解决鼠标延迟
电脑打开安装树莓派系统的TF卡,在根目录下找到cmdline.txt文件,打开编辑,在第一行的最后输入一个空格,添加入:
usbhid.mousepoll=0
-
使用HDMI和显示屏,安装系统ubuntu20.04系统(会比较慢,像是卡住,需要耐心等待)
-
启用ssh
sudo ps -e | grep ssh #检查SSH服务有没有开启 sudo apt-get update #先更新源 sudo apt-get install openssh-server
-
安装并配置ROS(noetic)环境
参考官方文档https://emanual.robotis.com/docs/en/platform/turtlebot3/overview/
-
安装并构建TurtleBot3软件包
sudo apt install ros-noetic-rosserial-python ros-noetic-tf
sudo apt install ros-noetic-hls-lfcd-lds-driver
sudo apt install ros-noetic-turtlebot3-msgs
sudo apt install ros-noetic-dynamixel-sdk
cd ~/catkin_ws/src/
git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
cd ~/catkin_ws/src/turtlebot3
rm -r turtlebot3_description/ turtlebot3_teleop/ turtlebot3_navigation/ turtlebot3_slam/ turtlebot3_example/
cd ~/catkin_ws && catkin_make -j1
source ~/.bashrc
- 使用rosdep安装依赖项
sudo apt install python3-rosdep2 ros-noetic-rosbash
cd ~/catkin_ws && rosdep update && rosdep install --from-paths src --ignore-src -r -y
-
USB端口设定
官方文档操作
rosrun turtlebot3_bringup create_udev_rules
cd ~/catkin_ws/src/turtlebot3/turtlebot3_bringup
sudo cp ./99-turtlebot3-cdc.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
- openCR设置
不进行这一步,后续rosrun会报checksum error,仍然按照官方文档进行,需要注意的是
wget https://github.com/ROBOTIS-GIT/OpenCR-Binaries/raw/master/turtlebot3/ROS1/latest/opencr_update.tar.bz2
在进行这一步时,会connect refuse,按照网上其他改host ip映射也不行,于是选择手动去下载。
网络设置
- 使用ifconfig命令获取远程PC和树莓派ip
树莓派
sudo vim ~/.bashrc #编辑修改
export ROS_MASTER_URI=http://{IP_ADDRESS_OF_REMOTE_PC}:11311
export ROS_HOSTNAME={IP_ADDRESS_OF_RASPBERRY_PI_3}
source ~/.bashrc
远程PC
sudo vim ~/.bashrc #编辑修改
export ROS_MASTER_URI=http://{IP_ADDRESS_OF_REMOTE_PC}:11311
export ROS_HOSTNAME={IP_ADDRESS_OF_REMOTE_PC}
source ~/.bashrc
开始使用
远程PC
roscore
TurtleBot3 SBC
roslaunch turtlebot3_bringup turtlebot3_robot.launch
远程PC新开一个terminal
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_bringup turtlebot3_model.launch
安装问题
- 遇到lose sync的error,记得连接上如激光等设备
- Creation of publisher failed: Checksum does not match:更新openCR固件
- Creation of publisher failed:{包名}:包未安装
- catkin编译卡住,参考https://www.cnblogs.com/vcan123/p/12218927.html顺利解决
谨记
网上教程很多,主要还是要以官方文档为主
标签:ubuntu20.04,noetic,Turtlebot3,sudo,turtlebot3,apt,install,ros 来源: https://www.cnblogs.com/realtxy/p/14659507.html