Turtlebot3+ubuntu20.04+ROSnoetic环境搭建
使⽤turtlebot3 burger进⾏实验,PC机已经安装好了ubuntu20.04环境
PC端安装ROS noetic
安装源
sudo sh -c 'echo "deb /ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
增加key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654更新
sudo apt update
安装
sudo apt install ros-noetic-desktop-full
环境设置
source /opt/ros/noetic/setup.bash
安装相关ROS依赖包
ubuntu vim命令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
树莓派环境安装
使⽤SD Card Formatter格式化SD卡
使⽤Raspberry Pi Image导⼊ubuntu系统⽂件
解决⿏标延迟
电脑打开安装树莓派系统的TF卡,在根⽬录下到⽂件,打开编辑,在第⼀⾏的最后输⼊⼀个空格,添加⼊:usepoll=0
使⽤HDMI和显⽰屏,安装系统ubuntu20.04系统(会⽐较慢,像是卡住,需要耐⼼等待)
启⽤ssh
sudo ps -e | grep ssh #检查SSH服务有没有开启
sudo apt-get update #先更新源
sudo apt-get install openssh-server
安装并配置ROS(noetic)环境
安装并构建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 github/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 github/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={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={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编译卡住,参考wwwblogs/vcan123/p/12218927.html顺利解决
谨记
⽹上教程很多,主要还是要以官⽅⽂档为主

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。