从零开始搭建自己的ROS机器人(turtlebot3)二.安装Turtlebot3环境

本文详细介绍了如何从头开始为Turtlebot3机器人搭建ROS环境,包括安装必要的依赖、创建工作空间、添加软件包和配置USB设备。步骤涵盖了从脚本安装到硬件连接的全过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

从零开始搭建自己的ROS机器人(turtlebot3)一、安装ROS环境.

可以安装脚本一键安装,之后直接跳至第5步
make_turtlebot3.sh下载链接.

1.安装环境

pip3 install catkin_pkg empy rospkg
sudo apt -y install libsdl1.2-dev libsdl-image1.2-dev qt4-default libusb-dev libspnav-dev libbluetooth-dev libcwiid-dev

2.创建ROS工作空间

创建文件夹并编译

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws && catkin_make
mkdir -p ~/turtlebot3_ws/src
cd ~/turtlebot3_ws && catkin_make

添加ROS_PACKAGE_PATH环境变量

echo -e "\nsource ~/catkin_ws/devel/setup.bash\nsource ~/turtlebot3_ws/devel/setup.bash" >> ~/.bashrc
echo -e "\nexport TURTLEBOT3_MODEL=waffle\nexport TURTLEBOT3_3D_SENSOR=kinetic\nexport TURTLEBOT3_LASER_SENSOR=rplidar" >> ~/.bashrc
source ~/.bashrc

3.创建catkin软件包

将 turtlebot3 文件放入src

  • 方法1:git 克隆
cd ~/catkin_ws/src
git clone -b melodic-devel https://github.com/ros-drivers/rosserial.git
git clone -b melodic-devel https://github.com/ros-planning/navigation.git
git clone -b ros1 https://github.com/ros-planning/navigation_msgs.git
git clone -b melodic-devel https://github.com/ros/geometry2.git
git clone -b melodic-devel https://github.com/hrnr/m-explore.git
git clone -b melodic-devel https://github.com/tu-darmstadt-ros-pkg/hector_slam.git
git clone -b melodic-devel https://github.com/ros-perception/slam_gmapping.git
git clone -b melodic-devel https://github.com/ros-perception/openslam_gmapping.git
git clone -b melodic-devel https://github.com/ROBOTIS-GIT/hls_lfcd_lds_driver.git
git clone -b melodic-devel https://github.com/ros-drivers/joystick_drivers.git
git clone https://github.com/Slamtec/rplidar_ros.git
cd ~/catkin_ws && catkin_make
cd ~/turtlebot3_ws/src
git clone -b melodic-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone -b melodic-devel https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
cd ~/turtlebot3_ws && catkin_make

4.创建一个工作空间以管理其他的工作空间

mkdir -p ~/my_ws/src
cd ~/my_ws && catkin_make
sed -i "s@'.split(';')@;/home/$USER/catkin_ws/devel;/home/$USER/turtlebot3_ws/devel'.split(';')@" ~/my_ws/devel/_setup_util.py
catkin_make
echo -e "\nsource ~/my_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

5.映射USB,编写udev规则

cd /etc/udev/rules.d/
sudo vi opencr.rules
sudo vi rplidar.rules
sudo service udev reload
sudo service udev restart

opencr.rules:

KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE:="0777", SYMLINK+="opencr"

rplidar.rules:

KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0777", SYMLINK+="rplidar"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dai_ding

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值