Apollo 10.0
自动驾驶开放平台
reeds_shepp_path.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
17/*
18* @file
19*/
20
21#pragma once
22
23#include <limits>
24#include <memory>
25#include <string>
26#include <utility>
27#include <vector>
28
29#include <omp.h>
30
31#include "modules/common_msgs/config_msgs/vehicle_config.pb.h"
32#include "modules/planning/planning_open_space/proto/planner_open_space_config.pb.h"
33
34#include "cyber/common/log.h"
35#include "cyber/common/macros.h"
39
40namespace apollo {
41namespace planning {
42
44 std::vector<double> segs_lengths;
45 std::vector<char> segs_types;
46 double total_length = 0.0;
47 double cost = 0.0;
48 std::vector<double> x;
49 std::vector<double> y;
50 std::vector<double> phi;
51 // true for driving forward and false for driving backward
52 std::vector<bool> gear;
53 double radius = 1.0;
54};
55
56struct RSPParam {
57 bool flag = false;
58 double t = 0.0;
59 double u = 0.0;
60 double v = 0.0;
61};
62
63class ReedShepp {
64 public:
66 const common::VehicleParam& vehicle_param,
67 const PlannerOpenSpaceConfig& open_space_conf);
68 virtual ~ReedShepp() = default;
69 // Pick the shortest path from all possible
70 // combination of movement primitives
71 // by Reed Shepp
72 bool ShortestRSP(
73 const std::shared_ptr<Node3d> start_node,
74 const std::shared_ptr<Node3d> end_node,
75 std::shared_ptr<ReedSheppPath> optimal_path);
76
77 protected:
78 // Generate all possible combination of
79 // movement primitives by Reed Shepp and
80 // interpolate them
81 bool GenerateRSPs(
82 const std::shared_ptr<Node3d> start_node,
83 const std::shared_ptr<Node3d> end_node,
84 std::vector<ReedSheppPath>* all_possible_paths);
85 // Set the general profile of the movement primitives
86 bool GenerateRSP(
87 const std::shared_ptr<Node3d> start_node,
88 const std::shared_ptr<Node3d> end_node,
89 std::vector<ReedSheppPath>* all_possible_paths);
90 // Set the general profile of the movement primitives,
91 // parallel implementation
92 bool GenerateRSPPar(
93 const std::shared_ptr<Node3d> start_node,
94 const std::shared_ptr<Node3d> end_node,
95 std::vector<ReedSheppPath>* all_possible_paths);
96 // Set local exact configurations profile of
97 // each movement primitive
99 const std::shared_ptr<Node3d> start_node,
100 const std::shared_ptr<Node3d> end_node,
101 ReedSheppPath* shortest_path);
102 // Interpolation usde in GenetateLocalConfiguration
103 void Interpolation(
104 const int index,
105 const double pd,
106 const char m,
107 const double ox,
108 const double oy,
109 const double ophi,
110 const double radius,
111 std::vector<double>* px,
112 std::vector<double>* py,
113 std::vector<double>* pphi,
114 std::vector<bool>* pgear);
115 // motion primitives combination setup function
116 bool SetRSP(
117 const int size,
118 const double* lengths,
119 const char* types,
120 std::vector<ReedSheppPath>* all_possible_paths,
121 double radius = 1.0);
122 // setRSP parallel version
123 bool SetRSPPar(
124 const int size,
125 const double* lengths,
126 const std::string& types,
127 std::vector<ReedSheppPath>* all_possible_paths,
128 const int idx);
129 bool CS(const double x, const double y, const double phi,
130 std::vector<ReedSheppPath>* all_possible_paths);
131 // Six different combination of motion primitive in Reed Shepp path used in
132 // GenerateRSP()
133 bool SCS(const double x, const double y, const double phi,
134 std::vector<ReedSheppPath>* all_possible_paths);
135 bool CSC(const double x, const double y, const double phi,
136 std::vector<ReedSheppPath>* all_possible_paths);
137 bool CCC(const double x, const double y, const double phi,
138 std::vector<ReedSheppPath>* all_possible_paths);
139 bool CCCC(const double x, const double y, const double phi,
140 std::vector<ReedSheppPath>* all_possible_paths);
141 bool CCSC(const double x, const double y, const double phi,
142 std::vector<ReedSheppPath>* all_possible_paths);
143 bool CCSCC(const double x, const double y, const double phi,
144 std::vector<ReedSheppPath>* all_possible_paths);
145 // different options for different combination of motion primitives
146 void LSL(const double x, const double y, const double phi, RSPParam* param);
147 void LSR(const double x, const double y, const double phi, RSPParam* param);
148 void LRL(const double x, const double y, const double phi, RSPParam* param);
149 void SLS(const double x, const double y, const double phi, RSPParam* param);
150 void LRLRn(const double x, const double y, const double phi, RSPParam* param);
151 void LRLRp(const double x, const double y, const double phi, RSPParam* param);
152 void LRSR(const double x, const double y, const double phi, RSPParam* param);
153 void LRSL(const double x, const double y, const double phi, RSPParam* param);
154 void LRSLR(const double x, const double y, const double phi, RSPParam* param);
155 void LS(const double x, const double y, const double phi, RSPParam* param);
156 std::pair<double, double> calc_tau_omega(const double u, const double v,
157 const double xi, const double eta,
158 const double phi);
159
160 protected:
171
172 // park generic
173 public:
174 ReedShepp(const common::VehicleParam& vehicle_param,
175 const WarmStartConfig& warm_start_conf);
176
178
179 protected:
181};
182} // namespace planning
183} // namespace apollo
void LRLRn(const double x, const double y, const double phi, RSPParam *param)
void LRL(const double x, const double y, const double phi, RSPParam *param)
PlannerOpenSpaceConfig planner_open_space_config_
void LSL(const double x, const double y, const double phi, RSPParam *param)
bool SetRSP(const int size, const double *lengths, const char *types, std::vector< ReedSheppPath > *all_possible_paths, double radius=1.0)
void LRSL(const double x, const double y, const double phi, RSPParam *param)
bool CCCC(const double x, const double y, const double phi, std::vector< ReedSheppPath > *all_possible_paths)
void LSR(const double x, const double y, const double phi, RSPParam *param)
void LRSLR(const double x, const double y, const double phi, RSPParam *param)
void SLS(const double x, const double y, const double phi, RSPParam *param)
bool GenerateLocalConfigurations(const std::shared_ptr< Node3d > start_node, const std::shared_ptr< Node3d > end_node, ReedSheppPath *shortest_path)
void Interpolation(const int index, const double pd, const char m, const double ox, const double oy, const double ophi, const double radius, std::vector< double > *px, std::vector< double > *py, std::vector< double > *pphi, std::vector< bool > *pgear)
void LRSR(const double x, const double y, const double phi, RSPParam *param)
common::VehicleParam vehicle_param_
std::pair< double, double > calc_tau_omega(const double u, const double v, const double xi, const double eta, const double phi)
bool ShortestRSP(const std::shared_ptr< Node3d > start_node, const std::shared_ptr< Node3d > end_node, std::shared_ptr< ReedSheppPath > optimal_path)
virtual ~ReedShepp()=default
bool CCC(const double x, const double y, const double phi, std::vector< ReedSheppPath > *all_possible_paths)
bool CCSCC(const double x, const double y, const double phi, std::vector< ReedSheppPath > *all_possible_paths)
bool CCSC(const double x, const double y, const double phi, std::vector< ReedSheppPath > *all_possible_paths)
ReedShepp(const common::VehicleParam &vehicle_param, const WarmStartConfig &warm_start_conf)
WarmStartConfig planner_warm_start_config_
bool GenerateRSPs(const std::shared_ptr< Node3d > start_node, const std::shared_ptr< Node3d > end_node, std::vector< ReedSheppPath > *all_possible_paths)
bool GenerateRSPPar(const std::shared_ptr< Node3d > start_node, const std::shared_ptr< Node3d > end_node, std::vector< ReedSheppPath > *all_possible_paths)
bool CS(const double x, const double y, const double phi, std::vector< ReedSheppPath > *all_possible_paths)
bool CSC(const double x, const double y, const double phi, std::vector< ReedSheppPath > *all_possible_paths)
bool SCS(const double x, const double y, const double phi, std::vector< ReedSheppPath > *all_possible_paths)
void LS(const double x, const double y, const double phi, RSPParam *param)
bool SetRSPPar(const int size, const double *lengths, const std::string &types, std::vector< ReedSheppPath > *all_possible_paths, const int idx)
bool GenerateRSP(const std::shared_ptr< Node3d > start_node, const std::shared_ptr< Node3d > end_node, std::vector< ReedSheppPath > *all_possible_paths)
void LRLRp(const double x, const double y, const double phi, RSPParam *param)
Planning module main class.
Math-related util functions.
class register implement
Definition arena_queue.h:37
std::vector< double > segs_lengths