Apollo 11.0
自动驾驶开放平台
dual_variable_warm_start_osqp_interface.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 <vector>
25
26#include "Eigen/Dense"
27#include "osqp/osqp.h"
28
29#include "modules/common_msgs/config_msgs/vehicle_config.pb.h"
30#include "modules/planning/planning_open_space/proto/planner_open_space_config.pb.h"
31
33
34namespace apollo {
35namespace planning {
36
38public:
40 size_t horizon,
41 double ts,
42 const Eigen::MatrixXd& ego,
43 const Eigen::MatrixXi& obstacles_edges_num,
44 const size_t obstacles_num,
45 const Eigen::MatrixXd& obstacles_A,
46 const Eigen::MatrixXd& obstacles_b,
47 const Eigen::MatrixXd& xWS,
48 const PlannerOpenSpaceConfig& planner_open_space_config);
49
51
52 void get_optimization_results(Eigen::MatrixXd* l_warm_up, Eigen::MatrixXd* n_warm_up) const;
53
54 bool optimize();
55
56 void assemble_P(std::vector<c_float>* P_data, std::vector<c_int>* P_indices, std::vector<c_int>* P_indptr);
57
58 void assemble_constraint(std::vector<c_float>* A_data, std::vector<c_int>* A_indices, std::vector<c_int>* A_indptr);
59
60 void assembleA(
61 const int r,
62 const int c,
63 const std::vector<c_float>& P_data,
64 const std::vector<c_int>& P_indices,
65 const std::vector<c_int>& P_indptr);
66
67 void check_solution(const Eigen::MatrixXd& l_warm_up, const Eigen::MatrixXd& n_warm_up);
68
69private:
70 OSQPConfig osqp_config_;
71 int num_of_variables_;
72 int num_of_constraints_;
73 int horizon_;
74 double ts_;
75 Eigen::MatrixXd ego_;
76 int lambda_horizon_ = 0;
77 int miu_horizon_ = 0;
78
79 Eigen::MatrixXd l_warm_up_;
80 Eigen::MatrixXd n_warm_up_;
81 double wheelbase_;
82
83 double w_ev_;
84 double l_ev_;
85 std::vector<double> g_;
86 double offset_;
87 Eigen::MatrixXi obstacles_edges_num_;
88 int obstacles_num_;
89 int obstacles_edges_sum_;
90
91 double min_safety_distance_;
92
93 // lagrangian l start index
94 int l_start_index_ = 0;
95
96 // lagrangian n start index
97 int n_start_index_ = 0;
98
99 // obstacles_A
100 Eigen::MatrixXd obstacles_A_;
101
102 // obstacles_b
103 Eigen::MatrixXd obstacles_b_;
104
105 // states of warm up stage
106 Eigen::MatrixXd xWS_;
107
108 // constraint A matrix in eigen format
109 Eigen::MatrixXf constraint_A_;
110
111 bool check_mode_;
112
113 // park generic
114public:
116 size_t horizon,
117 double ts,
118 const Eigen::MatrixXd& ego,
119 const Eigen::MatrixXi& obstacles_edges_num,
120 const size_t obstacles_num,
121 const Eigen::MatrixXd& obstacles_A,
122 const Eigen::MatrixXd& obstacles_b,
123 const Eigen::MatrixXd& xWS,
125};
126
127} // namespace planning
128} // namespace apollo
void assemble_P(std::vector< c_float > *P_data, std::vector< c_int > *P_indices, std::vector< c_int > *P_indptr)
void check_solution(const Eigen::MatrixXd &l_warm_up, const Eigen::MatrixXd &n_warm_up)
void assembleA(const int r, const int c, const std::vector< c_float > &P_data, const std::vector< c_int > &P_indices, const std::vector< c_int > &P_indptr)
void assemble_constraint(std::vector< c_float > *A_data, std::vector< c_int > *A_indices, std::vector< c_int > *A_indptr)
void get_optimization_results(Eigen::MatrixXd *l_warm_up, Eigen::MatrixXd *n_warm_up) const
Planning module main class.
class register implement
Definition arena_queue.h:37