office_RRT_star/README.md

60 lines
1.7 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
```
### 注意事项
每一个终端执行前建议:
```bash
source /opt/ros/humble/setup.bash
source /workspace/install/setup.bash
export NAV2_MAP_PATH=/workspace/src/turtlebot3_simulations/turtlebot3_gazebo/map/office_map.yaml
```
## 2. 启动仿真
```bash
./gzsim_run.sh
```
## 3. 启动 AMCL节点负责 “map_server + amcl”
```bash
ros2 launch nav2_rrtstar_planner bringup_localization_with_initial_pose.launch.py \
use_sim_time:=true \
map:=$NAV2_MAP_PATH \
params_file:=/workspace/src/TurtleBot-RRT-Star/nav2_params.yaml
```
## 4. 启动 Nav2导航栈负责 “RRT* 规划器 + controller + bt_navigator
```bash
ros2 launch nav2_bringup navigation_launch.py \
use_sim_time:=True \
params_file:=/workspace/src/TurtleBot-RRT-Star/nav2_params.yaml
```
## 5. 打开rviz
```bash
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)