Apollo planning之RuleBasedStopDecider

article/2025/10/13 9:12:10

Apollo studio 官网:Apollo开发者社区 (baidu.com)

星火计划2.0基础课:Apollo星火计划2.0_Apollo精品课 (baidu.com)
星火计划2.0专项课:Apollo星火计划之PnC专项_Apollo精品课 (baidu.com)

目录

1 基于规则的停止决策概览

2 代码流程

2.1 Stop on side pass

2.2 Check lane change Urgency

2.3 Add path end stop


1 基于规则的停止决策概览

//输入 
apollo::common::Status RuleBasedStopDecider::Process(Frame *const frame, ReferenceLineInfo *const reference_line_info)
//输入是frame和reference_line_info
//输出
输出保存到reference_line_info

2 代码流程

基于规则,碰到以上三种情况,会进行停止决策 

apollo::common::Status RuleBasedStopDecider::Process(Frame *const frame, ReferenceLineInfo *const reference_line_info) {// 1. 逆向车道通过,停止StopOnSidePass(frame, reference_line_info);// 2. 紧急换道,停止if (FLAGS_enable_lane_change_urgency_checking) {CheckLaneChangeUrgency(frame);}// 3. 路径尽头,停止AddPathEndStop(frame, reference_line_info);return Status::OK();
}

2.1 Stop on side pass

void RuleBasedStopDecider::StopOnSidePass(Frame *const frame, ReferenceLineInfo *const reference_line_info) {static bool check_clear;    // 默认falsestatic common::PathPoint change_lane_stop_path_point;// 获取path_dataconst PathData &path_data = reference_line_info->path_data();double stop_s_on_pathdata = 0.0;// 1. 找到"self",直接returnif (path_data.path_label().find("self") != std::string::npos) {check_clear = false;change_lane_stop_path_point.Clear();return;}// 2. 如果check_clear为true,且CheckClearDone成功。设置check_clear为falseif (check_clear &&CheckClearDone(*reference_line_info, change_lane_stop_path_point)) {check_clear = false;}// 3.如果check_clear为false,且检查stop fenceif (!check_clear &&CheckSidePassStop(path_data, *reference_line_info, &stop_s_on_pathdata)) {// 3.1 如果障碍物没有阻塞且可以换道,直接returnif (!LaneChangeDecider::IsPerceptionBlocked(*reference_line_info,rule_based_stop_decider_config_.search_beam_length(),rule_based_stop_decider_config_.search_beam_radius_intensity(),rule_based_stop_decider_config_.search_range(),rule_based_stop_decider_config_.is_block_angle_threshold()) &&LaneChangeDecider::IsClearToChangeLane(reference_line_info)) {return;}// 3.2 检查adc是否停在了stop fence前,否返回trueif (!CheckADCStop(path_data, *reference_line_info, stop_s_on_pathdata)) {// 设置stop fence,成功就执行 check_clear = true;if (!BuildSidePassStopFence(path_data, stop_s_on_pathdata,&change_lane_stop_path_point, frame,reference_line_info)) {AERROR << "Set side pass stop fail";}} else {if (LaneChangeDecider::IsClearToChangeLane(reference_line_info)) {check_clear = true;}}}
}

2.2 Check lane change Urgency

void RuleBasedStopDecider::CheckLaneChangeUrgency(Frame *const frame) {// 直接进入循环,检查每个reference_line_infofor (auto &reference_line_info : *frame->mutable_reference_line_info()) {// 1. 检查目标道路是否阻塞,如果在change lane path上,就跳过if (reference_line_info.IsChangeLanePath()) {is_clear_to_change_lane_ =LaneChangeDecider::IsClearToChangeLane(&reference_line_info);is_change_lane_planning_succeed_ =reference_line_info.Cost() < kStraightForwardLineCost;continue;}// 2.如果不是换道的场景,或者(目标lane没有阻塞)并且换道规划成功,跳过if (frame->reference_line_info().size() <= 1 ||(is_clear_to_change_lane_ && is_change_lane_planning_succeed_)) {continue;}// When the target lane is blocked in change-lane case, check the urgency// Get the end point of current routingconst auto &route_end_waypoint =reference_line_info.Lanes().RouteEndWaypoint();// 3.在route的末端无法获得lane,跳过if (!route_end_waypoint.lane) {continue;}auto point = route_end_waypoint.lane->GetSmoothPoint(route_end_waypoint.s);auto *reference_line = reference_line_info.mutable_reference_line();common::SLPoint sl_point;// 将当前参考线的点映射到frenet坐标系下if (reference_line->XYToSL(point, &sl_point) &&reference_line->IsOnLane(sl_point)) {// Check the distance from ADC to the end point of current routingdouble distance_to_passage_end =sl_point.s() - reference_line_info.AdcSlBoundary().end_s();// 4. 如果adc距离routing终点较远,不需要停止,跳过if (distance_to_passage_end >rule_based_stop_decider_config_.approach_distance_for_lane_change()) {continue;}// 5.如果遇到紧急情况,设置临时的stop fence,等待换道const std::string stop_wall_id = "lane_change_stop";std::vector<std::string> wait_for_obstacles;util::BuildStopDecision(stop_wall_id, sl_point.s(),rule_based_stop_decider_config_.urgent_distance_for_lane_change(),StopReasonCode::STOP_REASON_LANE_CHANGE_URGENCY, wait_for_obstacles,"RuleBasedStopDecider", frame, &reference_line_info);}}
}

2.3 Add path end stop

当参考线起点与终点距离小于某个阈值,说明没有办法规划出一条较长的路径,所以我们需要对终点添加stop fence ,这时候需要退出动态重规划的过程,而是在一段距离后停车

void RuleBasedStopDecider::AddPathEndStop(Frame *const frame, ReferenceLineInfo *const reference_line_info) {if (!reference_line_info->path_data().path_label().empty() &&reference_line_info->path_data().frenet_frame_path().back().s() -reference_line_info->path_data().frenet_frame_path().front().s() <FLAGS_short_path_length_threshold) {const std::string stop_wall_id =PATH_END_VO_ID_PREFIX + reference_line_info->path_data().path_label();std::vector<std::string> wait_for_obstacles;// 创建stop fenceutil::BuildStopDecision(stop_wall_id,reference_line_info->path_data().frenet_frame_path().back().s() - 5.0,0.0, StopReasonCode::STOP_REASON_REFERENCE_END, wait_for_obstacles,"RuleBasedStopDecider", frame, reference_line_info);}
}

 本文参考基于规则的停止决策 — Apollo Auto 0.0.1 文档 (daobook.github.io)

若有侵权,请联系删除 


http://chatgpt.dhexx.cn/article/6Uqq2yTw.shtml

相关文章

Unity SWS自动寻路插件

简介 Simple Waypoint System&#xff08;SWS&#xff09;是基于Dotween的一款路径动画插件&#xff0c;&#xff0c;SWS在Dotween的基础上实现了可编辑路径&#xff0c;并且支持自动检测2D和3D模式 使用 导入插件后&#xff0c;选择Window->Simple Waypoint System->…

DeepRacer线下比赛总结 2022 地图 Re Invent 2018

先看笔者团队线下的DeepRacer Model测试动图gif。 1. 线下比赛策略&#xff1a; 激进&#xff1a;waypoint 还是有点激进&#xff0c;感觉跟速度没多大关系。稳妥&#xff1a;不用waypoint&#xff0c;中线。默认的中线算法&#xff0c;1m/s~2.8m/s, 模拟器可以抛出10m/s 的…

【Unity3d】Simple Waypoint System插件介绍

Simple Waypoint System&#xff08;SWS&#xff09;是基于Dotween的一款路径动画插件&#xff0c;Dotween想必大家比较熟悉&#xff0c;是一款很好用的动画插件&#xff0c;SWS在Dotween的基础上实现了可编辑路径&#xff0c;并且支持自动检测2D和3D模式。 导入插件后我们可…

unity20——寻路插件sws(simple waypoint system)

先上插件获取方式&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/18_BOjPhNVIyqJjos5pnddQ 提取码&#xff1a;ceod 1. Simple Waypoint System&#xff08;SWS&#xff09;是基于Dotween的一款路径动画插件&#xff0c;&#xff0c;SWS在Dotween的基础上实现了可编辑路…

unity的自动寻路之 ------ wayPoint寻路的实现方式

孙广东 2015.6.28 看了看 Unity的官方案例&#xff0c;就顺便看了 wayPoint相关。 效果&#xff1a; WaypointProgressTracker.cs 【固定】 WaypointCircuit.cs 【固定】 using System; using System.Collections; using UnityEngine; #if UNITY_EDITOR using UnityEdito…

【Unity】关于Waypoint的寻路

创建一个名为Path的C#脚本 <span style"font-size:24px;"><span style"font-size:24px;">using UnityEngine; using System.Collections; using System.Collections.Generic; public class Enemy : MonoBehaviour {public float MoveSpeed 3.…

Autoware实车测试记录(四)--全局及局部路径规划相关功能以及发送控制指令至底盘

经过前面的一系列工作&#xff0c;现在小车在地图中任意位置已经可以实现实时定位以及检测到障碍物以及追踪这些障碍物。下面的内容主要是继续完成下一步-路径规划&#xff0c;这其中包括了全局宏观上的路径规划&#xff08;全局路径规划&#xff09;以及在行走过程中对障碍物进…

ROS-使用命令发布导航目标点(publish point)

目录 手动发布rviz中的publish point思路方法实现publish point的发布的话题“/clicked_point”发布“/clicked_point”内容 使用脚本发布一系列的点疑惑补充 手动发布rviz中的publish point 我在利用move—base跑仿真时&#xff0c;是使用的rviz中的publish point按钮&#x…

大疆无人机安卓Mobile Sdk开发(三)制定航点任务WaypointMission

大疆无人机安卓Mobile Sdk开发&#xff08;一&#xff09;简单介绍 大疆无人机安卓Mobile Sdk开发&#xff08;二&#xff09;连接无人机&#xff0c;获取无人机信息 大疆无人机安卓Mobile Sdk开发&#xff08;三&#xff09;制定航点任务WaypointMission 大疆无人机安卓Mob…

ROS学习记录(四)基于ROS的A*算法仿真

代码来源:https://github.com/KailinTong/Motion-Planning-for-Mobile-Robots/tree/master/hw_2. 文章目录 前言一、获取代码二、过程演示1.启动roscore2.打开rviz3.打开rviz文件4.新建终端加载地图5.进行路径搜索 三、ROS包node.hAstar_searcher.hAstar_searcher.cppdemo_node…

利用Random Waypoint Model生成室内轨迹数据

利用Random Waypoint Model生成室内轨迹数据 1 模型简介1.1 Random Waypoint Model1.2 Random Walk Model1.3 Random Direction Model 2 生成轨迹数据链接 在做室内定位方面的实验时&#xff0c;打算利用RNN进行室内定位&#xff0c;而利用RNN做定位则需要室内行人的轨迹数据做…

pinpoint和skyWalking

首先&#xff0c;上个别人的研究成果&#xff0c;我也是踩着巨人的肩膀继续前进的。 随着pinpoint版本的迭代更新&#xff0c;这图上的结论有些已经过时了&#xff0c;比如pinpoint方面&#xff1a; 1.协议&#xff0c;最新2.1.0版本也是默认使用gRPC的&#xff1b; 2.TraceI…

航迹大师(Waypoint Master)怎么样

WayPoint Master(航迹大师)是一款针对大疆无人机倾斜摄影测量的专业级航线定制软件。 主要可分为&#xff1a;环绕航线、仿地航线、仿面航线、Lidar航线、电力航线。 1.区域环绕&#xff1a;生成区域交叉环绕航线&#xff0c;可以增强模型细节并有效减少外业照 片数量&#xff…

Autoware学习笔记waypoint_follower之pure_pursuit

1.pure_pursuit的launch文件如下。 <!-- --> <launch><arg name"is_linear_interpolation" default"True"/> <arg name"publishes_for_steering_robot" default"False"/> <!-- rosrun waypoint_fol…

寻路 Waypoint 与 NavMesh 比较

正文 1. WayPoint寻路 下图是一个典型的路点寻路 另一种方法是使用多边形来记录路径信息&#xff0c;它可以提供更多的信息给ai角色使用。下图就是一个navigation mesh。 以下列出几个WayPoint的不足之处&#xff1a; 一些复杂的游戏地图需要的WayPoint数量过于庞大有时会使角色…

CARLA 笔记(07)— 地图和导航(Landmarks、Waypoints、Lanes、Junctions、Environment Objects、路径点导航、地图导航、分层和非分层地图)

1. 地图 地图包括城镇的 3D 模型和道路定义。地图的道路定义基于 OpenDRIVE 文件&#xff0c;这是一种标准化的带注释的道路定义格式。 OpenDRIVE 定义道路、车道、路口等的方式决定了 Python API 的功能以及做出决策背后的原因。 1.1 更换地图 要改变地图&#xff0c;世界…

【Autoware】三、ROSBAG生成waypoint

1.启动Autoware cd ~/autoware.ai/ source install/setup.bash roslaunch runtime_manager runtime_manager.launch2.切换到Simulation模块 点击右侧的Ref&#xff0c;选择文件&#xff1a; /.autoware/sample_moriyama_150324.bag点击Play按钮以后&#xff0c;立马点击Paus…

第五篇:AWS deepracer student 赛道分析(Ace speedway)最佳路径,数据分析,waypoint分析(初步

文章目录 前言一,为什么需要分析赛道二&#xff0c;分析赛道需要的东西三&#xff0c;如何获得waypoint数据四&#xff0c;正式开始1.获取waypoint的数据2.处理数据 三&#xff0c;导入excel表绘图1.将txt文件导入excel表2.插入散点图3.成品图带有标识的版本最佳路径图&#xf…

unity3d WayPoint路点寻路,AI

前言 一个简单的人工智能WayPoint WayPoint: 游戏中敌人根据几个巡逻点自动巡逻&#xff0c;在巡逻过程中&#xff0c;时刻监听英雄&#xff08;敌人&#xff09;和自己距离是否达到追击范围&#xff08;不巡逻&#xff0c;追击英雄&#xff09;&#xff0c;在追击过程中&…

Unity中的AI算法和实现1-Waypoint

本文分享Unity中的AI算法和实现1-Waypoint 在Unity中, 我们有一些有趣且常见的AI算法可以研究和使用, 其中最常见的就是怪物的简单AI, 比如在RPG游戏里, 怪物在某些点定点巡逻, 当玩家进入检测区域时, 怪物会主动追击玩家, 追击到玩家后对玩家进行伤害, 或者在超过最大距离后脱…