Apollo 11.0
自动驾驶开放平台
obstacle_nudge_decider.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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
19#include <algorithm>
20#include <memory>
21
22#include "modules/common_msgs/planning_msgs/decision.pb.h"
23
29
30namespace apollo {
31namespace planning {
32
36
38 const std::string &config_dir,
39 const std::string &name,
40 const std::shared_ptr<DependencyInjector> &injector) {
41 if (!Task::Init(config_dir, name, injector)) {
42 return false;
43 }
44 // Load the config this task.
45 if (!Task::LoadConfig<ObstacleNudgeDeciderConfig>(&config_)) {
46 return false;
47 }
48 // reset NudgeCalculation
49 nudge_calc_.reset(new NudgeCalculation(config_));
50
51 return true;
52}
53
55 Task::Execute(frame, reference_line_info);
56 return Process(frame, reference_line_info);
57}
58
59Status ObstacleNudgeDecider::Process(Frame *frame, ReferenceLineInfo *reference_line_info) {
60 if (reference_line_info->index() == 0 && nullptr != injector_->frame_history()->Latest()) {
61 ParkDataCenter::Instance()->UpdateHistoryNudgeInfo(injector_->frame_history()->Latest()->SequenceNum());
62 AINFO << "Update history nudge info";
63 }
64 AINFO << "Task process: ObstacleNudgeDecider start.";
65 if (!FLAGS_enable_nudge_decider || !config_.enbale_nugde_static_obs() || nullptr == reference_line_info
66 || reference_line_info->path_reusable()) {
67 AINFO << "path reusable" << reference_line_info->path_reusable() << ",skip";
68 return Status::OK();
69 }
70
71 bool adc_in_nudge_state
72 = injector_->planning_context()->planning_status().path_decider().is_in_path_lane_borrow_scenario();
73
74 // update for nudge calc
75 nudge_calc_->set_in_nudge_state(adc_in_nudge_state);
76
77 // calc for nudge decision
78 nudge_calc_->BuildNudgeDecisionWithObs(frame, injector_->frame_history()->Latest(), reference_line_info_);
79
80 AINFO << "ObstacleNudgeDecider end";
81 return Status::OK();
82}
83
84} // namespace planning
85} // 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
@Brief This is a helper class that can load vehicle configurations.
Frame holds all data for one planning cycle.
Definition frame.h:62
apollo::common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info) override
bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector) override
ReferenceLineInfo holds all data for one reference line.
std::shared_ptr< DependencyInjector > injector_
Definition task.h:59
ReferenceLineInfo * reference_line_info_
Definition task.h:58
virtual bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector)
Definition task.cc:40
virtual common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info)
Definition task.cc:60
Planning module main class.
#define AINFO
Definition log.h:42
Some util functions.
class register implement
Definition arena_queue.h:37