Apollo 10.0
自动驾驶开放平台
|
LaneFollowMap
: PncMapBase
的一个子类,在lane_follow_command
指令下,从routing结果转换到ReferenceLine的过程中做前期准备,主要功能是处理routing结果,将routing数据处理并存储在map相关的数据结构中;根据routing结果及当前车辆位置,计算可行驶的passage信息,并转换成RouteSegments结构,为ReferenceLine提供数据传入参数。封装在reference_line_provider中。
LaneFollowMap
中对路径进行RoadSegment,Passage,LaneSegment的存储如下图所示
index
为当前lane_segment 的 {road_index, passage_index, lane_index}
的三元组。 route_indices_
中的序号index。 成员变量 | 说明 |
---|---|
std::vector<RouteIndex> route_indices_ | 存储routing所有road,passage,lane的信息 |
int range_start_ | 主车根据routing结果更新搜索区间的起始序号 |
int range_end_ | 主车根据routing结果更新搜索区间的终止序号 |
std::unordered_set<std::string> range_lane_ids_ | 在搜索区间内的所有lane的id |
std::unordered_set<std::string> all_lane_ids_ | 当前routing结果的所有lane的id |
std::vector<WaypointIndex> routing_waypoint_index_ | 当前routing结果的所有waypoint及对应序号 |
std::size_t next_routing_waypoint_index_ | 下一个经过的waypoint |
common::VehicleState adc_state_ | 主车状态 |
int adc_route_index_ | 主车所处的route的序号 |
apollo::hdmap::LaneWaypoint adc_waypoint_ | 主车所处的waypoint |
planning::PlanningCommand &command
,每当有新的routing结果时,用最新的RoutingResponse对LaneFollowMap
里的数据进行更新。用三个for循环分别剥离出routing结果里的road,passage,lane,将每条lane的id存进all_lane_ids_
这个数组中;将每个lane_segment
及{road_index, passage_index, lane_index}
存进route_indices_
中。range_start_
,range_end_
,adc_route_index_
,next_routing_waypoint_index_
,调用UpdateRoutingRange
成员函数将routing结果的lane_id存放进range_lane_ids_
中。routing_waypoint_index_
中,routing信息的转换完毕。VehicleState &vehicle_state
,根据主车状态,调用GetNearestPointFromRouting
成员函数从routing中查找到最近的道路点adc_waypoint_
。adc_waypoint_
调用GetWaypointIndex
成员函数查找到当前行驶的LaneSegment在route_indices_
中的序号route_index
,并更新至adc_route_index_
。UpdateNextRoutingWaypointIndex
成员函数,传入参数route_index
, 计算主车下一个必经的waypoint点,并赋给next_routing_waypoint_index_
。UpdateRoutingRange
成员函数,传入参数adc_route_index_
,更新主车未经过的路线存放进range_lane_ids_
中。ReferenceLineProvider
中被调用,用于更新获取当前route_segments
,为参考线构建提供数据支持。const VehicleState &vehicle_state, std::list<hdmap::RouteSegments> *const route_segments
,引用传参route_segments
更新route数据。LookForwardDistance
,根据车辆当前速度计算前向搜索距离look_forward_distance。后向搜索look_backward_distance由参数控制。GetRouteSegments
的重载函数获取route_segments
,传入参数为vehicle_state, look_backward_distance, look_forward_distance, route_segments
。vehicle_state, look_backward_distance, look_forward_distance, route_segments
。UpdateVehicleState
,更新route状态。adc_route_index_
,获得当前出车所处的RoadSegment
和Passage
的序号road_index
、passage_index
,根据当前road和passage,调用GetNeighborPassages
计算当前车道的所有相邻passage的信息drive_passages
。drive_passages
进行操作。调用PassageToSegments
成员函数,将passage转换为hdmap::RouteSegments segments
,并且计算主车到当前segments
的投影点,从该投影点,按照前向搜索距离look_forward_distance,后向搜索距离look_backward_distance,进行segments的扩展。从而得到当前passage的segments
,并且保存至route_segments
。const routing::RoadSegment &road, int start_passage
,被GetRouteSegments
调用,实线从主车当前所在start_passage
获取临近passage。source_passage.change_lane_type() == routing::FORWARD
,当前passage可以不经过变道直达目标点;或者 source_passage.can_exit()
,当前passage可退出,到达目标点,则不需要搜索临近passages,return退出。source_passage
获取source_segments
,并根据当前lane_segemnts,以及目标通路的方向,分别向左右搜索临近的车道,将id保存至neighbor_lanes
。road
的所有passages,保存与neighbor_lanes
相同id的lane_segment
。routing::Passage passage, hdmap::RouteSegments *segments
passage
中的lane_segment
,将其类型转换为RouteSegments
,保存至segments
。adc_index
route_indices_
,从主车当前adc_index
开始的route id保存至range_lane_ids_
。const VehicleState &state, hdmap::LaneWaypoint *waypoint
,根据主车位置获取最近waypoint
。all_lane_ids_
,获取所有可用lane,保存至valid_lanes
。valid_lanes
,获取所有主车纵向所处车道内的waypoints,保存至valid_way_points
。valid_way_points
,获取所有主车纵向所处车道内的waypoints,保存至valid_way_points
。valid_way_points
,获取最近的waypoint
。const hdmap::LaneWaypoint &waypoint
,通过前向和后向搜索,返回该waypoint在route_indices_
中的index。int cur_index
,从当前index,计算routing结果中的下一个需要经过的waypoint,更新next_routing_waypoint_index_
。apollo::planning::LaneFollowMap
在modules/planning/planning_component/conf/planning_config.pb.txt
文件中修改reference_line_config
的配置,配置使用LaneFollowMap
。
如果您在使用文档的过程中,遇到任何问题,请到我们在【开发者社区】建立的 反馈意见收集问答页面,反馈相关的问题。我们会根据反馈意见对文档进行迭代优化。