Apollo 10.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
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) const;
50
51 bool optimize();
52
53 void assemble_P(std::vector<c_float>* P_data, std::vector<c_int>* P_indices,
54 std::vector<c_int>* P_indptr);
55
56 void assemble_constraint(std::vector<c_float>* A_data,
57 std::vector<c_int>* A_indices,
58 std::vector<c_int>* A_indptr);
59
60 void assembleA(const int r, const int c, const std::vector<c_float>& P_data,
61 const std::vector<c_int>& P_indices,
62 const std::vector<c_int>& P_indptr);
63
64 void check_solution(const Eigen::MatrixXd& l_warm_up,
65 const Eigen::MatrixXd& n_warm_up);
66
67 private:
68 OSQPConfig osqp_config_;
69 int num_of_variables_;
70 int num_of_constraints_;
71 int horizon_;
72 double ts_;
73 Eigen::MatrixXd ego_;
74 int lambda_horizon_ = 0;
75 int miu_horizon_ = 0;
76
77 Eigen::MatrixXd l_warm_up_;
78 Eigen::MatrixXd n_warm_up_;
79 double wheelbase_;
80
81 double w_ev_;
82 double l_ev_;
83 std::vector<double> g_;
84 double offset_;
85 Eigen::MatrixXi obstacles_edges_num_;
86 int obstacles_num_;
87 int obstacles_edges_sum_;
88
89 double min_safety_distance_;
90
91 // lagrangian l start index
92 int l_start_index_ = 0;
93
94 // lagrangian n start index
95 int n_start_index_ = 0;
96
97 // obstacles_A
98 Eigen::MatrixXd obstacles_A_;
99
100 // obstacles_b
101 Eigen::MatrixXd obstacles_b_;
102
103 // states of warm up stage
104 Eigen::MatrixXd xWS_;
105
106 // constraint A matrix in eigen format
107 Eigen::MatrixXf constraint_A_;
108
109 bool check_mode_;
110
111// park generic
112 public:
114 size_t horizon, double ts, const Eigen::MatrixXd& ego,
115 const Eigen::MatrixXi& obstacles_edges_num, const size_t obstacles_num,
116 const Eigen::MatrixXd& obstacles_A, const Eigen::MatrixXd& obstacles_b,
117 const Eigen::MatrixXd& xWS,
119};
120
121} // namespace planning
122} // namespace apollo
void assemble_P(std::vector< c_float > *P_data, std::vector< c_int > *P_indices, std::vector< c_int > *P_indptr)
DualVariableWarmStartOSQPInterface(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 &DualVariableWarmStartConfig)
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