Apollo 11.0
自动驾驶开放平台
public_road_planner.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
21
22namespace apollo {
23namespace planning {
24
27
29 const std::shared_ptr<DependencyInjector>& injector,
30 const std::string& config_path) {
31 Planner::Init(injector, config_path);
32 LoadConfig<PlannerPublicRoadConfig>(config_path, &config_);
33 scenario_manager_.Init(injector, config_);
34 return Status::OK();
35}
36
38 Frame* frame,
39 ADCTrajectory* ptr_computed_trajectory) {
40 scenario_manager_.Update(planning_start_point, frame);
41 scenario_ = scenario_manager_.mutable_scenario();
42 if (!scenario_) {
44 "Unknown Scenario");
45 }
46 auto result = scenario_->Process(planning_start_point, frame);
47
48 if (FLAGS_enable_record_debug) {
49 auto scenario_debug = ptr_computed_trajectory->mutable_debug()
50 ->mutable_planning_data()
51 ->mutable_scenario();
52 scenario_debug->set_scenario_plugin_type(scenario_->Name());
53 scenario_debug->set_stage_plugin_type(scenario_->GetStage());
54 scenario_debug->set_msg(scenario_->GetMsg());
55 }
56
57 if (result.GetScenarioStatus() == ScenarioStatusType::STATUS_DONE) {
58 // only updates scenario manager when previous scenario's status is
59 // STATUS_DONE
60 scenario_manager_.Update(planning_start_point, frame);
61 } else if (result.GetScenarioStatus() == ScenarioStatusType::STATUS_UNKNOWN) {
63 result.GetTaskStatus().error_message());
64 }
65 return Status(common::OK, result.GetTaskStatus().error_message());
66}
67
68} // namespace planning
69} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
static Status OK()
generate a success status.
Definition status.h:60
Frame holds all data for one planning cycle.
Definition frame.h:62
virtual apollo::common::Status Init(const std::shared_ptr< DependencyInjector > &injector, const std::string &config_path="")
Definition planner.h:54
common::Status Init(const std::shared_ptr< DependencyInjector > &injector, const std::string &config_path="") override
common::Status Plan(const common::TrajectoryPoint &planning_init_point, Frame *frame, ADCTrajectory *ptr_computed_trajectory) override
Override function Plan in parent class Planner.
bool Init(const std::shared_ptr< DependencyInjector > &injector, const PlannerPublicRoadConfig &planner_config)
void Update(const common::TrajectoryPoint &ego_point, Frame *frame)
const std::string & GetMsg() const
Definition scenario.h:96
virtual ScenarioResult Process(const common::TrajectoryPoint &planning_init_point, Frame *frame)
Definition scenario.cc:86
const std::string GetStage() const
Definition scenario.cc:170
const std::string & Name() const
Definition scenario.h:98
Planning module main class.
class register implement
Definition arena_queue.h:37