Apollo 11.0
自动驾驶开放平台
speed_decider.h
浏览该文件的文档.
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
21#pragma once
22
23#include <memory>
24#include <string>
25#include <unordered_map>
26#include <utility>
27#include <vector>
28
29#include "modules/planning/tasks/speed_decider/proto/speed_decider.pb.h"
30
35
36namespace apollo {
37namespace planning {
38
39class SpeedDecider : public Task {
40 public:
41 bool Init(const std::string& config_dir, const std::string& name,
42 const std::shared_ptr<DependencyInjector>& injector) override;
43
45 ReferenceLineInfo* reference_line_info) override;
46
47 private:
48 enum STLocation {
49 ABOVE = 1,
50 BELOW = 2,
51 CROSS = 3,
52 };
53
54 STLocation GetSTLocation(const PathDecision* const path_decision,
55 const SpeedData& speed_profile,
56 const STBoundary& st_boundary) const;
57
58 bool CheckKeepClearCrossable(const PathDecision* const path_decision,
59 const SpeedData& speed_profile,
60 const STBoundary& keep_clear_st_boundary) const;
61
62 bool CheckKeepClearBlocked(const PathDecision* const path_decision,
63 const Obstacle& keep_clear_obstacle) const;
64
72 bool CheckIsFollow(const Obstacle& obstacle,
73 const STBoundary& boundary) const;
74
75 bool CheckStopForPedestrian(const Obstacle& obstacle) const;
76
77 bool CreateStopDecision(const Obstacle& obstacle,
78 ObjectDecisionType* const stop_decision,
79 double stop_distance) const;
80
84 bool CreateFollowDecision(const Obstacle& obstacle,
85 ObjectDecisionType* const follow_decision) const;
86
90 bool CreateYieldDecision(const Obstacle& obstacle,
91 ObjectDecisionType* const yield_decision) const;
92
96 bool CreateOvertakeDecision(
97 const Obstacle& obstacle,
98 ObjectDecisionType* const overtake_decision) const;
99
100 common::Status MakeObjectDecision(const SpeedData& speed_profile,
101 PathDecision* const path_decision) const;
102
103 void AppendIgnoreDecision(Obstacle* obstacle) const;
104
110 bool IsFollowTooClose(const Obstacle& obstacle) const;
111
112 double EstimateProperOvertakingGap(const double target_obs_speed,
113 const double adc_speed) const;
114
115 double EstimateProperFollowGap(const double& adc_speed) const;
116
117 private:
118 SLBoundary adc_sl_boundary_;
119 common::TrajectoryPoint init_point_;
120 const ReferenceLine* reference_line_ = nullptr;
121 SpeedDeciderConfig config_;
122 std::vector<std::pair<double, double>> follow_distance_function_;
123};
124
126
127} // namespace planning
128} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
Frame holds all data for one planning cycle.
Definition frame.h:62
This is the class that associates an Obstacle with its path properties.
Definition obstacle.h:62
PathDecision represents all obstacle decisions on one path.
ReferenceLineInfo holds all data for one reference line.
bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector) override
common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info) override
Planning module main class.
#define CYBER_PLUGIN_MANAGER_REGISTER_PLUGIN(name, base)
class register implement
Definition arena_queue.h:37