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