Apollo 11.0
自动驾驶开放平台
dual_variable_warm_start_slack_osqp_interface.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
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, Eigen::MatrixXd* s_warm_up)
53 const;
54
55 bool optimize();
56
57 void assembleP(std::vector<c_float>* P_data, std::vector<c_int>* P_indices, std::vector<c_int>* P_indptr);
58
59 void assembleConstraint(std::vector<c_float>* A_data, std::vector<c_int>* A_indices, std::vector<c_int>* A_indptr);
60
61 void assembleA(
62 const int r,
63 const int c,
64 const std::vector<c_float>& P_data,
65 const std::vector<c_int>& P_indices,
66 const std::vector<c_int>& P_indptr);
67
68 void checkSolution(const Eigen::MatrixXd& l_warm_up, const Eigen::MatrixXd& n_warm_up);
69
70 void printMatrix(
71 const int r,
72 const int c,
73 const std::vector<c_float>& P_data,
74 const std::vector<c_int>& P_indices,
75 const std::vector<c_int>& P_indptr);
76
77private:
78 OSQPConfig osqp_config_;
79
80 int num_of_variables_;
81 int num_of_constraints_;
82 int horizon_;
83 double ts_;
84 Eigen::MatrixXd ego_;
85 int lambda_horizon_ = 0;
86 int miu_horizon_ = 0;
87 int slack_horizon_ = 0;
88 double beta_ = 0.0;
89
90 Eigen::MatrixXd l_warm_up_;
91 Eigen::MatrixXd n_warm_up_;
92 Eigen::MatrixXd slacks_;
93 double wheelbase_;
94
95 double w_ev_;
96 double l_ev_;
97 std::vector<double> g_;
98 double offset_;
99 Eigen::MatrixXi obstacles_edges_num_;
100 int obstacles_num_;
101 int obstacles_edges_sum_;
102
103 double min_safety_distance_;
104
105 // lagrangian l start index
106 int l_start_index_ = 0;
107
108 // lagrangian n start index
109 int n_start_index_ = 0;
110
111 // slack s start index
112 int s_start_index_ = 0;
113
114 // obstacles_A
115 Eigen::MatrixXd obstacles_A_;
116
117 // obstacles_b
118 Eigen::MatrixXd obstacles_b_;
119
120 // states of warm up stage
121 Eigen::MatrixXd xWS_;
122
123 // constraint A matrix in eigen format
124 Eigen::MatrixXf constraint_A_;
125
126 bool check_mode_;
127
128 // park generic
129public:
131 size_t horizon,
132 double ts,
133 const Eigen::MatrixXd& ego,
134 const Eigen::MatrixXi& obstacles_edges_num,
135 const size_t obstacles_num,
136 const Eigen::MatrixXd& obstacles_A,
137 const Eigen::MatrixXd& obstacles_b,
138 const Eigen::MatrixXd& xWS,
139 const DualVariableWarmStartConfig& dual_variable_warm_start_config);
140};
141
142} // namespace planning
143} // namespace apollo
void get_optimization_results(Eigen::MatrixXd *l_warm_up, Eigen::MatrixXd *n_warm_up, Eigen::MatrixXd *s_warm_up) const
void assembleP(std::vector< c_float > *P_data, std::vector< c_int > *P_indices, std::vector< c_int > *P_indptr)
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 printMatrix(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 assembleConstraint(std::vector< c_float > *A_data, std::vector< c_int > *A_indices, std::vector< c_int > *A_indptr)
void checkSolution(const Eigen::MatrixXd &l_warm_up, const Eigen::MatrixXd &n_warm_up)
Planning module main class.
class register implement
Definition arena_queue.h:37