Apollo 11.0
自动驾驶开放平台
precise_parking_scenario.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2024 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
25
26namespace apollo {
27namespace planning {
31
32bool PreciseParkingScenario::Init(std::shared_ptr<DependencyInjector> injector, const std::string& name) {
33 if (!Scenario::Init(injector, name)) {
34 AERROR << "failed to init scenario" << Name();
35 return false;
36 }
37
38 if (!Scenario::LoadConfig<ScenarioPreciseParkingConfig>(&context_.scenario_config)) {
39 AERROR << "fail to get config of scenario" << Name();
40 return false;
41 }
42 return true;
43}
44
45bool PreciseParkingScenario::IsTransferable(const Scenario* const other_scenario, const Frame& frame) {
46 const auto& planning_command = frame.local_view().planning_command;
47 if (!planning_command->has_custom_command()) {
48 return false;
49 }
50 if (!planning_command->custom_command().Is<PreciseParkingCommand>()) {
51 return false;
52 }
53 context_.precise_parking_command.Clear();
54 if (!planning_command->custom_command().UnpackTo(&context_.precise_parking_command)) {
55 AERROR << "Precise Parking Command unpack error" << planning_command->DebugString();
56 return false;
57 }
58 return true;
59} // namespace planning
60
61} // namespace planning
62} // namespace apollo
The class of polygon in 2-D.
Definition polygon2d.h:42
Implements a class of 2-dimensional vectors.
Definition vec2d.h:42
Frame holds all data for one planning cycle.
Definition frame.h:62
const LocalView & local_view() const
Definition frame.h:163
bool IsTransferable(const Scenario *const other_scenario, const Frame &frame) override
Each scenario should define its own transfer condition, i.e., when it should allow to transfer from o...
bool Init(std::shared_ptr< DependencyInjector > injector, const std::string &name) override
virtual bool Init(std::shared_ptr< DependencyInjector > injector, const std::string &name)
Definition scenario.cc:43
const std::string & Name() const
Definition scenario.h:98
Planning module main class.
#define AERROR
Definition log.h:44
class register implement
Definition arena_queue.h:37
std::shared_ptr< PlanningCommand > planning_command
Definition local_view.h:48
apollo::external_command::PreciseParkingCommand precise_parking_command