office_RRT_star/README.md

61 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

* 基于 RRT * 的路径规划与导航
实现功能:替换 Nav2 规划器为RRT-Star自定义插件实现渐近最优路径规划支持从 RViz2 设置目标点完成自主导航。RRT* 被用于导航与路径规划,它具有渐近最优性, 即随着采样点数量增加,解会收敛到最优路径,同时能高效探索高维空间。
## 1. 环境要求
- Ubuntu 22.04
- ROS2 Humble
- Gazebo Sim Harmonic
---
### 编译
```bash
cd /workspace
colcon build --symlink-install
source /opt/ros/humble/setup.bash
source install/setup.bash
```
### 注意事项
之后每打开一个新终端,都建议先执行:
```bash
source /opt/ros/humble/setup.bash
source install/setup.bash
export TURTLEBOT3_MODEL=burger
export NAV2_MAP_PATH=/workspace/src/turtlebot3_simulations/turtlebot3_gazebo/map/office_map.yaml
```
为了方便,也可以写入 `~/.bashrc`
```bash
echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
echo 'source /workspace/install/setup.bash' >> ~/.bashrc
echo 'export TURTLEBOT3_MODEL=burger' >> ~/.bashrc
echo 'export NAV2_MAP_PATH=/workspace/src/turtlebot3_simulations/turtlebot3_gazebo/map/office_map.yaml' >> ~/.bashrc
source ~/.bashrc
```
1. 每个终端都要按照3.2.1前置准备操作
2. 启动仿真, Nav2导航栈 AMCL节点rviz
```bash
./gzsim_run.sh
ros2 launch nav2_bringup navigation_launch.py \
use_sim_time:=True \
params_file:=$HOME/ros_ws/src/vlm-semantic-nav2/TurtleBot-RRT-Star/nav2_params.yaml \
map:=$NAV2_MAP_PATH
ros2 launch nav2_rrtstar_planner bringup_localization_with_initial_pose.launch.py \
use_sim_time:=true \
map:=$NAV2_MAP_PATH
ros2 run rviz2 rviz2 -d /opt/ros/humble/share/nav2_bringup/rviz/nav2_default_view.rviz --ros-args -p use_sim_time:=true
```
点击 RViz2 中Nav2 Goal在地图上选择目标位置调整箭头设置机器人到达后的朝向确认后机器人将通过 RRT * 算法生成最优路径并自主导航RViz2 中将实时显示 RRT * 规划的全局路径。
![图6](assets/picture06.png)