Apollo 11.0
自动驾驶开放平台
open_space_replan_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
22
23namespace apollo {
24namespace planning {
25
28
30 const std::string &config_dir, const std::string &name,
31 const std::shared_ptr<DependencyInjector> &injector) {
32 if (!Decider::Init(config_dir, name, injector)) {
33 return false;
34 }
35 return Decider::LoadConfig<OpenSpaceReplanDeciderConfig>(&config_);
36}
37
38Status OpenSpaceReplanDecider::Process(Frame *frame) {
39 const auto& previous_frame = injector_->frame_history()->Latest();
40 if (frame == nullptr || previous_frame == nullptr) {
41 const std::string msg =
42 "Invalid frame, fail to process the OpenSpaceReplanDecider.";
43 AERROR << msg;
44 return Status(ErrorCode::PLANNING_ERROR, msg);
45 }
46 if (previous_frame->open_space_info().optimizer_trajectory_data().empty() &&
47 injector_->vehicle_state()->linear_velocity() <
49 vehicle_param().max_abs_speed_when_stopped()) {
51 } else {
53 }
54 return Status::OK();
55}
56
57} // namespace planning
58} // 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
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
Frame holds all data for one planning cycle.
Definition frame.h:62
OpenSpaceInfo * mutable_open_space_info()
Definition frame.h:169
void set_replan_flag(const bool flag)
bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector) override
std::shared_ptr< DependencyInjector > injector_
Definition task.h:59
virtual bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector)
Definition task.cc:40
Planning module main class.
#define AERROR
Definition log.h:44
class register implement
Definition arena_queue.h:37