Apollo 11.0
自动驾驶开放平台
navi_speed_decider.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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#pragma once
23
24#include <string>
25#include <vector>
26
27#include "gtest/gtest.h"
28
29#include "modules/planning/planning_base/proto/planning_config.pb.h"
30
36
41namespace apollo {
42namespace planning {
43
52class NaviSpeedDecider : public NaviTask {
53 public:
55 virtual ~NaviSpeedDecider() = default;
56
57 bool Init(const PlannerNaviConfig& config) override;
58
67 Frame* frame, ReferenceLineInfo* reference_line_info) override;
68
69 private:
81 apollo::common::Status MakeSpeedDecision(
82 double start_v, double start_a, double start_da,
83 const std::vector<common::PathPoint>& path_points,
84 const std::vector<const Obstacle*>& obstacles,
85 const std::function<const Obstacle*(const std::string& id)>&
86 find_obstacle,
87 SpeedData* const speed_data);
88
93 apollo::common::Status AddPerceptionRangeConstraints();
94
104 apollo::common::Status AddObstaclesConstraints(
105 double vehicle_speed, double path_length,
106 const std::vector<common::PathPoint>& path_points,
107 const std::vector<const Obstacle*>& obstacles,
108 const std::function<const Obstacle*(const std::string& id)>&
109 find_obstacle);
110
115 apollo::common::Status AddTrafficDecisionConstraints();
116
122 apollo::common::Status AddCentricAccelerationConstraints(
123 const std::vector<common::PathPoint>& path_points);
124
129 apollo::common::Status AddConfiguredConstraints();
130
131 void RecordDebugInfo(const SpeedData& speed_data);
132
133 private:
134 double preferred_speed_;
135 double max_speed_;
136 double preferred_accel_;
137 double preferred_decel_;
138 double preferred_jerk_;
139 double max_accel_;
140 double max_decel_;
141 double obstacle_buffer_;
142 double safe_distance_base_;
143 double safe_distance_ratio_;
144 double following_accel_ratio_;
145 double soft_centric_accel_limit_;
146 double hard_centric_accel_limit_;
147 double hard_speed_limit_;
148 double hard_accel_limit_;
149 bool enable_safe_path_;
150 bool enable_planning_start_point_;
151 bool enable_accel_auto_compensation_;
152 double kappa_preview_;
153 double kappa_threshold_;
154
155 NaviObstacleDecider obstacle_decider_;
156 NaviSpeedTsGraph ts_graph_;
157
158 double prev_v_ = 0.0;
159 double accel_compensation_ratio_ = 1.0;
160 double decel_compensation_ratio_ = 1.0;
161
162 FRIEND_TEST(NaviSpeedDeciderTest, CreateSpeedData);
163 FRIEND_TEST(NaviSpeedDeciderTest, CreateSpeedDataForStaticObstacle);
164 FRIEND_TEST(NaviSpeedDeciderTest, CreateSpeedDataForObstacles);
165 FRIEND_TEST(NaviSpeedDeciderTest, CreateSpeedDataForCurve);
166};
167
168} // namespace planning
169} // 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
NaviObstacleDecider is used to make appropriate decisions for obstacles around the vehicle in navigat...
NaviSpeedDecider is used to generate an appropriate speed curve of the vehicle in navigation mode.
apollo::common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info) override
Overrided implementation of the virtual function "Execute" in the base class "Task".
bool Init(const PlannerNaviConfig &config) override
NaviSpeedTsGraph is used to generate a t-s graph with some limits and preferred.
This is the class that associates an Obstacle with its path properties.
Definition obstacle.h:62
ReferenceLineInfo holds all data for one reference line.
Planning module main class.
class register implement
Definition arena_queue.h:37
This file provides the declaration of the class "NaviSpeedDecider".
This file provides the declaration of the class "NaviSpeedTsGraph".