【背景】
打算通过Navigation2来了解ROS2的核心两大件——LifeCircle和BehaviorTree,结果根据官网的教程一顿鼓捣,这个Turtlbot3的仿真就是跑不起来,这怎么能忍?虽然在Ubuntu20上使用Foxy版本可以非常容易就跑通demo,但是我这个人就是不信邪,我偏要在Ubuntu18上把这小乌龟跑起来!于是就开始了漫漫DEBUG路。
【干货】
系统环境
- Ubuntu 18.04
- ROS2 Eloquent
软件代码栈
1、手动下载 Nav2 源码包
GitHub - ros-planning/navigation2 at eloquent-develROS2 Navigation Framework and System. Contribute to ros-planning/navigation2 development by creating an account on GitHub.https://github.com/ros-planning/navigation2/tree/eloquent-devel2、手动下载 BehaviorTree 源码包
Release 3.5.6 · BehaviorTree/BehaviorTree.CPP · GitHubBehavior Trees Library in C++. Batteries included. - Release 3.5.6 · BehaviorTree/BehaviorTree.CPPhttps://github.com/BehaviorTree/BehaviorTree.CPP/releases/tag/3.5.63、将上述两个包解压到 ~/nav2_ws/src/ 目录中,运行以下命令
colcon build
4、编译过程遇到有依赖缺失,则运行以下命令(pkg-name替换为缺失的包名)
sudo apt install ros-eloquent-<pkg-name>
5、安装 Turtlebot3 仿真环境
sudo apt install ros-eloquent-turtlebot3*
【开跑】
cd ~/nav2_ws/
export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/eloquent/share/turtlebot3_gazebo/models
source install/setup.bash
ros2 launch nav2_bringup nav2_tb3_simulation_launch.py
RViz打开后,点击左下角的 startup ,并给机器人一个初始位置,然后就可以给 goal ,让乌龟动了
【问题】
- 如果启动Gazebo的时候,终端冒出来一行红字“Err:LibCul:xxxxx”,就执行以下操作
gedit .ignition/fuel/config.yaml
将里面内容改成下面这样:
---
# The list of servers.
servers:
-
name: osrf
# url: https://api.ignitionfuel.org
url: https://api.ignitionrobotics.org
# -
# name: another_server
# url: https://myserver
# Where are the assets stored in disk.
# cache:
# path: /tmp/ignition/fuel
2、ROS Eloquent的源码存在一个bug,当我们长时间让 Turtlebot 处于 idle 状态时,planner_server就会报一个错
https://github.com/ros2/rclcpp/issues/1266https://github.com/ros2/rclcpp/issues/1266