Apollo 11.0
自动驾驶开放平台
path_boundary.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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
20#pragma once
21
22#include <string>
23#include <tuple>
24#include <utility>
25#include <vector>
26
27namespace apollo {
28namespace planning {
29
30#define LEFT_INDEX 0
31#define RIGHT_INDEX 1
32
33enum BoundType { ROAD = 0, LANE = 1, OBSTACLE = 2, ADC = 3 };
34struct BoundEdge {
36 double l = 0;
37 std::string id;
38};
39
62
63class ObsCornerConstraints : public std::vector<InterPolatedPoint> {
64 public:
65 std::string blocked_id;
68};
69
70class ADCVertexConstraints : public std::vector<InterPolatedPoint> {
71 public:
73};
74
77 PathBoundPoint(double s_init, double l_min, double l_max) {
78 s = s_init;
79 l_lower.l = l_min;
80 l_upper.l = l_max;
81 }
82 bool operator<(const PathBoundPoint& other) const { return s < other.s; }
83 double width() const { return l_upper.l - l_lower.l; }
84 bool is_passable() const { return l_upper.l - l_lower.l > 0; }
85 double s = 0;
86 double towing_l = 0;
89 bool is_nudge_bound[2] = {false, false};
90};
91
92using PathBound = std::vector<PathBoundPoint>;
93
94class PathBoundary : public std::vector<PathBoundPoint> {
95 public:
97 PathBoundary(const double start_s, const double delta_s,
98 std::vector<std::pair<double, double>> path_boundary);
104 PathBoundary(const double delta_s, const PathBound& path_bound);
105 virtual ~PathBoundary() = default;
106 void set_delta_s(double s);
107 double start_s() const;
108
109 double delta_s() const;
110
111 void set_boundary(const std::vector<std::pair<double, double>>& boundary);
112 std::vector<std::pair<double, double>> boundary() const;
113 bool get_interpolated_s_weight(const double s, double* left_weight,
114 double* right_weight, size_t* left_index,
115 size_t* right_index) const;
116 double get_lower_bound_by_s(const double s);
117 double get_upper_bound_by_s(const double s);
118 double get_lower_bound_by_interpolated_index(double left_weight,
119 double right_weight,
120 size_t left_index,
121 size_t right_index) const;
122 double get_upper_bound_by_interpolated_index(double left_weight,
123 double right_weight,
124 size_t left_index,
125 size_t right_index) const;
126 void set_label(const std::string& label);
127 const std::string& label() const;
128
129 void set_blocking_obstacle_id(const std::string& obs_id);
130 const std::string& blocking_obstacle_id() const;
131 void DebugString(std::string name);
133 return &extra_path_bound_;
134 }
136 return extra_path_bound_;
137 }
139 return &adc_vertex_bound_;
140 }
142 return adc_vertex_bound_;
143 }
144
145 private:
146 double start_s_ = 0.0;
147 double delta_s_ = 0.0;
148 ObsCornerConstraints extra_path_bound_;
149 ADCVertexConstraints adc_vertex_bound_;
150 std::string label_ = "regular";
151 std::string blocking_obstacle_id_ = "";
152};
153
154} // namespace planning
155} // namespace apollo
void set_label(const std::string &label)
void set_boundary(const std::vector< std::pair< double, double > > &boundary)
void DebugString(std::string name)
void set_blocking_obstacle_id(const std::string &obs_id)
PathBoundary(const double delta_s, const PathBound &path_bound)
construct class by path bound
double get_upper_bound_by_interpolated_index(double left_weight, double right_weight, size_t left_index, size_t right_index) const
bool get_interpolated_s_weight(const double s, double *left_weight, double *right_weight, size_t *left_index, size_t *right_index) const
ADCVertexConstraints * mutable_adc_vertex_bound()
const ObsCornerConstraints & extra_path_bound() const
const std::string & blocking_obstacle_id() const
ObsCornerConstraints * mutable_extra_path_bound()
const std::string & label() const
PathBoundary(const double start_s, const double delta_s, std::vector< std::pair< double, double > > path_boundary)
const ADCVertexConstraints & adc_vertex_bound() const
virtual ~PathBoundary()=default
std::vector< std::pair< double, double > > boundary() const
double get_lower_bound_by_interpolated_index(double left_weight, double right_weight, size_t left_index, size_t right_index) const
double get_lower_bound_by_s(const double s)
double get_upper_bound_by_s(const double s)
Planning module main class.
std::vector< PathBoundPoint > PathBound
class register implement
Definition arena_queue.h:37
InterPolatedPoint(double left_weight, double right_weight, double lower_bound, double upper_bound, size_t left_index, size_t right_index, double rear_axle_s, std::string id="")
bool operator<(const PathBoundPoint &other) const
PathBoundPoint(double s_init, double l_min, double l_max)