Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze the source code of Planning module

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article is to share with you about how to analyze the source code of the Planning module, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

The Planning module is located in the namespace: apollo::planning, and its function is to construct the local driving path of the unmanned vehicle from the starting point to the end point. Specifically, given the navigation map, navigation path, current location point, vehicle status, perception and prediction information of the surrounding targets, the planning module calculates a safe and comfortable driving path for the control module to execute.

The output path of the planning module is a local path rather than a global path. For example, if an unmanned vehicle needs to drive from Changsha Intelligent driving Research Institute to Changsha High-speed Railway South Station, the first step is to output the global navigation path with the help of Routing module, and then the planning module plans a short or specific driving path based on the global navigation path.

The function of the planning module is to plan a trajectory that the vehicle can drive according to the current vehicle information and road conditions according to the results of perceptual prediction, which will be given to the control module, which passes through the throttle. Brake and steering wheel make the vehicle run according to the planned track.

Preface

The trajectory of the planning module is the short-term track, that is, the short-term track of the vehicle, and the long-term track is the navigation track planned by the Routing module, that is, the track from the starting point to the destination. The planning module will turn it into a navigation track, and then follow the short-term track until the destination according to the navigation track and road conditions.

The internal structure of the planning module and its interaction with other modules are shown in the following figure.

Module main entrance

According to the analysis of the startup process of each functional module, the main entrance of the Planning module is:

Int main (int argc, char** argv) {2 google::SetUsageMessage ("we use this program to load dag and run user apps."); 3 4 / / parse the argument 5 ModuleArgument module_args; 6 module_args.ParseArgument (argc, argv); 7 8 / / initialize cyber 9 apollo::cyber::Init (argv [0]); 1011 / / start module12 ModuleController controller (module_args); 13 if (! controller.Init ()) {14 controller.Clear (); 15 AERROR CreateObj () It makes sense to create the PlanningComponent class object.

Analysis of specific planning algorithm

PublicRoadPlanner programming algorithm

The PublicRoadPlanner algorithm obtains the global navigation path from the high-precision map Lane sequence output by the Routing module.

The advantage of planning based on the concept of scene, phase and task is that it can deal with each scene reasonably and effectively, is easy to expand, and has strong flexibility to dynamically add or decrease scenes, phases and tasks based on configuration files; the disadvantage is that some special scenarios may be omitted, but can be solved by constantly expanding new scenarios.

The main execution flow of the algorithm is as follows:

You can have a deeper understanding of the above execution process with the help of GDB debugging commands, such as the call stack of PathLaneBorrowDecider tasks in the TrafficLightProtectedStageApproach phase. From bottom to top, the call flow of any task is clear at a glance:

# 0 apollo::planning::PathLaneBorrowDecider::Process (this=0x7f8c28294460, frame=0x7f8c38029f70, 2 reference_line_info=0x7f8c3802b140) at modules/planning/tasks/deciders/path_lane_borrow_decider/path_lane_borrow_decider.cc:39 3 # 1 0x00007f8c0468b7c8 in apollo::planning::Decider::Execute (this=0x7f8c28294460, frame=0x7f8c38029f70, 4 reference_line_info=0x7f8c3802b140) at modules/planning/tasks/deciders/decider.cc:31 5 # 2 0x00007f8c065c4a01 in apollo::planning::scenario::Stage::ExecuteTaskOnReferenceLine (this=0x7f8c28293eb0, 6 planning_start_point=...) Frame=0x7f8c38029f70) at modules/planning/scenarios/stage.cc:96 7: 3 0x00007f8c06e721da in apollo::planning::scenario::traffic_light::TrafficLightProtectedStageApproach::Process (8 this=0x7f8c28293eb0, planning_init_point=..., frame=0x7f8c38029f70) at 9 modules/planning/scenarios/traffic_light/protected/stage_approach.cc:4810#4 0x00007f8c067f1732 in apollo::planning::scenario::Scenario::Process (11 this=0x7f8c2801bf20, planning_init_point=...) Frame=0x7f8c38029f70) 12 at modules/planning/scenarios/scenario.cc:7613#5 0x00007f8c186e153a in apollo::planning::PublicRoadPlanner::Plan (14 this=0x23093de0, planning_start_point=..., frame=0x7f8c38029f70, 15 ptr_computed_trajectory=0x7f8b9a5fbed0) at modules/planning/planner/public_road/public_road_planner.cc:5116#6 0x00007f8c19ee5937 in apollo::planning::OnLanePlanning::Plan (17 this=0x237f3b0, current_time_stamp=1557133995.3679764, stitching_trajectory=std::vector of length 1, 18 capacity 1 = {.} Ptr_trajectory_pb=0x7f8b9a5fbed0) at modules/planning/on_lane_planning.cc:43619#7 0x00007f8c19ee40fa in apollo::planning::OnLanePlanning::RunOnce (20 this=0x237f3b0, local_view=..., ptr_trajectory_pb=0x7f8b9a5fbed0) at modules/planning/on_lane_planning.cc:30421#8 0x00007f8c1ab0d494 in apollo::planning::PlanningComponent::Proc (22 this=0x1d0f310, prediction_obstacles=std::shared_ptr (count 4, weak 0) 0x7f8b840164f8, 23 chassis=std::shared_ptr (count 4, weak 0) 0x7f8b84018a08 24 localization_estimate=std::shared_ptr (count 4, weak 0) 0x7f8b8400d3b8) at modules/planning/planning_component.cc:13425#9 0x00007f8c1abb46c4 in apollo::cyber::Component26 apollo::canbus::Chassis, apollo::localization::LocalizationEstimate, apollo::cyber::NullType >: Process (this=0x1d0f310, 27 msg0=std::shared_ptr (count 4, weak 0) 0x7f8b840164f8, msg1=std::shared_ptr (count 4, weak 0) 0x7f8b84018a08, 28 msg2=std::shared_ptr (count 4 Weak 0) 0x7f8b8400d3b8) at. / cyber/component/component.h:29129#10 0x00007f8c1aba2698 in apollo::cyber::Component30 apollo::canbus::Chassis, apollo::localization::LocalizationEstimate, apollo::cyber::NullType >:: Initialize (31 apollo::cyber::proto::ComponentConfig const&):: {lambda (std::shared_ptr const&, 32 std::shared_ptr const&, std::shared_ptr const&) # 2}:: operator () 33 (std::shared_ptr const& Std::shared_ptr const&, 34 std::shared_ptr const&) const (_ _ closure=0x2059a430, 35 msg0=std::shared_ptr (count 4, weak 0) 0x7f8b840164f8, msg1=std::shared_ptr (count 4, weak 0) 0x7f8b84018a08, 36 msg2=std::shared_ptr (count 4) Weak 0) 0x7f8b8400d3b8) at. / cyber/component/component.h:37837#11 0x00007f8c1abb4ad2 in apollo::cyber::croutine::RoutineFactory apollo::cyber::croutine::CreateRoutineFactory38 43 (apollo::cyber::Component::Initialize (apollo::cyber::proto::ComponentConfig const&):: 45 {lambda (std::shared_ptr const&, std::shared_ptr const&, 46 std::shared_ptr const&) # 2} & 47 std::shared_ptr const&):: 49 {lambda () # 1}:: operator () const:: {lambda () # 1}:: operator () () const (_ _ closure=0x2059a420) at. / cyber/croutine/routine_factory.h:10850#12 0x00007f8c1ac0466a in std::_Function_handler51apollo::cyber::croutine::CreateRoutineFactory55 (apollo::cyber::Component::Initialize (apollo::cyber::proto::ComponentConfig const&):: {lambda (std::shared_ptr const&) 57std::shared_ptr const&, std::shared_ptr const&) # 2} &, 58std::shared_ptr const&):: {lambda () # 1}:: operator () () const:: {lambda () # 1} >:: _ M_invoke (std::_Any_data const&) (_ _ functor=...) At 60/usr/include/c++/4.8/functional:207161#13 0x00007f8c5f5b86e8 in std::function::operator () () const (this=0x205f1160) at / usr/include/c++/4.8/functional:247162#14 0x00007f8c57560cbc in apollo::cyber::croutine::CRoutine::Run (this=0x205f1148) at. / cyber/croutine/croutine.h:14363#15 0x00007f8c5755ff55 in apollo::cyber::croutine:: (anonymous namespace):: CRoutineEntry (arg=0x205f1148) at cyber/croutine/croutine.cc:43

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report