31 std::vector<common::math::Vec2d> obstacle_vertices;
32 for (
int i = 0; i < vertice_num; i++) {
34 obstacle_vertices.emplace_back(vertice);
36 obstacles_list.emplace_back(obstacle_vertices);
39 return obstacles_list;
43 std::vector<std::vector<common::math::Vec2d>> obstacles_list;
50 std::vector<common::math::Vec2d> soft_boundary_vertices;
51 for (
int i = 0; i < vertice_num; i++) {
53 soft_boundary_vertices.emplace_back(vertice);
55 soft_boundary_list.emplace_back(soft_boundary_vertices);
57 for (
int i = 0; i < soft_boundary_list.size(); ++i) {
58 for (
const auto& vertice : soft_boundary_list[i]) {
59 AERROR <<
"Soft boundary: " << i <<
", " << vertice.x() <<
", " << vertice.y();
64 return soft_boundary_list;
68 std::vector<std::vector<common::math::Vec2d>> soft_boundary_list;
75 x_ = std::move(result_.
x);
76 y_ = std::move(result_.
y);
77 phi_ = std::move(result_.
phi);
78 v_ = std::move(result_.
v);
79 a_ = std::move(result_.
a);
80 steer_ = std::move(result_.
steer);
82 std::vector<double>*
GetX() {
85 std::vector<double>*
GetY() {
91 std::vector<double>*
GetV() {
94 std::vector<double>*
GetA() {
106 std::vector<double> x_;
107 std::vector<double> y_;
108 std::vector<double> phi_;
109 std::vector<double> v_;
110 std::vector<double> a_;
111 std::vector<double> steer_;
116 FLAGS_planner_open_space_config_filename
117 =
"/apollo/modules/planning/planning_component/"
118 "conf/planner_hybrid_a_star_config.pb.txt";
122 FLAGS_planner_open_space_config_filename, &planner_open_space_config_))
123 <<
"Failed to load open space config file " << FLAGS_planner_open_space_config_filename;
124 return new HybridAStar(planner_open_space_config_);
144 double* soft_boundary_x,
145 double* soft_boundary_y,
162 std::vector<double> XYbounds_(XYbounds, XYbounds + 4);
163 return planner_ptr->
Plan(
184 size_t* output_size) {
186 size_t size = result_ptr->
GetX()->size();
187 std::cout <<
"return size is " << size << std::endl;
188 for (
size_t i = 0; i < size; i++) {
189 x[i] = result_ptr->
GetX()->at(i);
190 y[i] = result_ptr->
GetY()->at(i);
191 phi[i] = result_ptr->
GetPhi()->at(i);
192 v[i] = result_ptr->
GetV()->at(i);
194 for (
size_t i = 0; i < size - 1; i++) {
195 a[i] = result_ptr->
GetA()->at(i);
196 steer[i] = result_ptr->
GetSteer()->at(i);
Implements a class of 2-dimensional vectors.
HybridAObstacleContainer()=default
const std::vector< std::vector< common::math::Vec2d > > & GetObstaclesVerticesVec()
void AddVirtualObstacle(double *obstacle_x, double *obstacle_y, int vertice_num)
std::vector< double > * GetX()
HybridAStartResult * PrepareResult()
std::vector< double > * GetA()
std::vector< double > * GetSteer()
std::vector< double > * GetY()
std::vector< double > * GetV()
std::vector< double > * GetPhi()
HybridAResultContainer()=default
HybridASoftBoundaryContainer()=default
void AddVirtualSoftBoundary(double *obstacle_x, double *obstacle_y, int vertice_num)
const std::vector< std::vector< common::math::Vec2d > > & GetSoftBoundaryVerticesVec()
bool Plan(double sx, double sy, double sphi, double ex, double ey, double ephi, const std::vector< double > &XYbounds, const std::vector< std::vector< common::math::Vec2d > > &obstacles_vertices_vec, HybridAStartResult *result, const std::vector< std::vector< common::math::Vec2d > > &soft_boundary_vertices_vec={}, bool reeds_sheep_last_straight=false)
Planning module main class.
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
void AddVirtualSoftBoundary(HybridASoftBoundaryContainer *soft_boundary_ptr, double *soft_boundary_x, double *soft_boundary_y, int vertice_num)
HybridAObstacleContainer * CreateObstaclesPtr()
HybridASoftBoundaryContainer * CreateSoftBoundaryPtr()
bool Plan(HybridAStar *planner_ptr, HybridAObstacleContainer *obstacles_ptr, HybridASoftBoundaryContainer *soft_boundary_ptr, HybridAResultContainer *result_ptr, double sx, double sy, double sphi, double ex, double ey, double ephi, double *XYbounds)
void AddVirtualObstacle(HybridAObstacleContainer *obstacles_ptr, double *obstacle_x, double *obstacle_y, int vertice_num)
void GetResult(HybridAResultContainer *result_ptr, double *x, double *y, double *phi, double *v, double *a, double *steer, size_t *output_size)
HybridAResultContainer * CreateResultPtr()
HybridAStar * CreatePlannerPtr()
std::vector< double > steer
std::vector< double > phi