Go to file
liuhaoyan e301e7cf67 Stanley control algorithm add
For real vehicle test
2026-09-24 10:32:19 +08:00
src Stanley control algorithm add 2026-09-24 10:32:19 +08:00
.gitignore Stanley control algorithm add 2026-09-24 10:32:19 +08:00
lqr_plot_path_tracking_error.py Stanley control algorithm add 2026-09-24 10:32:19 +08:00
pp_lqr_stanley_error.py Stanley control algorithm add 2026-09-24 10:32:19 +08:00
pp_stanley_plot_path_tracking_error.py Stanley control algorithm add 2026-09-24 10:32:19 +08:00
Readme.md Stanley control algorithm add 2026-09-24 10:32:19 +08:00
rviz2.jpg transform path and optimize control algorithm 2026-09-11 17:37:47 +08:00

auto drive misson center webots simulation:

该分支修复了原LQR算法中矩阵错误问题,并对参数进行调教,增加stanley前轮转向控制算法,并适配webots仿真环境。后续实车测试优先使用该分支

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

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, 运行 webots 与 rviz可视化界面

ros2 launch webots_simulation robot_launch.py ,等待rviz2界面打开后,加载配置文件: File->Open Config-> 选择 SweetAiRviz.rviz ,方便起见,打开后,File->Save Config 下次不用再重复加载。该 rviz界面 左右两侧拉开留出视图空间。(test:1701895544295370752.json) 测试版本中path_visualizer pkg目前与launch一起启动,其路径代码可在src/webots_simulation/src/PathVisualizer.cpp 中修改file_name实现

6, 模拟 /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

7, 运行 mission_center 任务节点

运行 ros2 launch auto_drive_misson_center mission_center_launch.py 启动 任务节点。

8, 请求 /invoke/missionOn 服务

另启一个终端,执行发送任务命令,这里的任务,必须和 5 中的匹配,将1701895544295370752.json内容填充到指令中:

ros2 service call /invoke/missionOn auto_drive_proj_msg/srv/ReqString "{request: '[{\"name\":\"value\",\"value\":\"https://test.sweetai.cn:4433/load/locationCmdPath/1701895544295370752.json\"}]', value: ''}"

观察任务轨迹以及rviz2右侧panel面板参数

rviz2 panel: 界面示意图