39 lines
2.4 KiB
Markdown
39 lines
2.4 KiB
Markdown
# auto drive misson center webots simulation:
|
||
|
||
## 1, `ubuntu20.04`, `ubuntu22.04`
|
||
## 2, 安装 `webots`
|
||
`https://github.com/cyberbotics/webots/tags`, 版本: `ubuntu20.04: R2023a, ubuntu22.04:R2025a`
|
||
## 3, 创建ros2 工作空间
|
||
如 `~/sweet_ws `, 编译 `sweet_webots_robot, robots_rviz_panel, webots_simulation, auto_drive_proj_utils,auto_drive_proj_msg, auto_drive_misson_center`
|
||
```shell
|
||
cd ~/sweet_ws
|
||
colcon build --packages-select sweet_webots_robot --cmake-clean-cache
|
||
source install/setup.bash
|
||
colcon build --packages-select robots_rviz_panel --cmake-clean-cache
|
||
source install/setup.bash
|
||
colcon build --packages-select webots_simulation --cmake-clean-cache
|
||
source install/setup.bash
|
||
colcon build --packages-select auto_drive_proj_utils --cmake-clean-cache
|
||
source install/setup.bash
|
||
colcon build --packages-select auto_drive_proj_msg --cmake-clean-cache
|
||
source install/setup.bash
|
||
colcon build --packages-select auto_drive_misson_center --cmake-clean-cache
|
||
source install/setup.bash
|
||
```
|
||
## 4, 运行 webots:
|
||
终端执行命令: `webots`
|
||
## 5, 运行 rviz2界面
|
||
`ros2 launch webots_simulation robot_launch.py` ,等待rviz2界面打开后,加载配置文件:` File->Open Config->` 选择 `SweetAiRviz.rviz` ,方便起见,打开后,File->Save Config 下次不用再重复加载。该 rviz界面 左右两侧拉开留出视图空间。
|
||
## 6, 运行 path_visualizer
|
||
`ros2 run webots_simulation path_visualizer` ,提示 : 请输入路径文件路径: ,输入`https://test.sweetai.cn:4433/load/locationCmdPath/`中任意一个json文件名即可,如:`1699983696942006272.json`
|
||
## 7, 模拟 `/start_pose` 服务
|
||
另启一个终端,模拟 `/start_pose` 服务,常开,执行脚本(注意路径):`python3 /home/ada/sweet_ws/install/auto_drive_misson_center/share/auto_drive_misson_center/scripts/mock_start_pose_and_publish_rtk.py `
|
||
## 8, 运行 mission_center 任务节点
|
||
运行 `ros2 launch auto_drive_misson_center mission_center_launch.py` 启动 任务节点。
|
||
## 9, 请求 /invoke/missionOn 服务
|
||
另启一个终端,执行发送任务命令,这里的任务,必须和 `6` 中的匹配,将11699983696942006272.json1内容填充到指令中:
|
||
```shell
|
||
ros2 service call /invoke/missionOn auto_drive_proj_msg/srv/ReqString "{request: '[{\"name\":\"value\",\"value\":\"https://test.sweetai.cn:4433/load/locationCmdPath/1699983696942006272.json\"}]', value: ''}"
|
||
```
|
||
> 观察任务轨迹。
|