Open zhou-0423 opened 11 months ago
- E:/C++/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp:30: undefined reference to
OsqpEigen::debugStream()' E:/C++/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp:35: undefined reference to
csc_spalloc'
I think this can be related to https://github.com/osqp/osqp/issues/576
the system is windows10, osqp 0.6.3,osqp-eigen0.8.1. In s-function-builder of matlab, configure is (E:\C++\eigen\install1\include\eigen3;E:\C++\osqp\include;E:\C++\osqp-eigen\include). code is: / Includes_BEGIN /
include
include
include <Eigen/Dense>
include
include <OsqpEigen/OsqpEigen.h>
define PI acos(-1)
//幂计算函数 Eigen::MatrixXd multi_matrix(Eigen::MatrixXd Matrix_1, Eigen::MatrixXd Matrix_2, const int n) //两个方阵相乘,n为方阵维度 { Eigen::MatrixXd Matrix; Matrix.resize(Matrix_1.rows(), Matrix_1.cols()); Matrix = Eigen::MatrixXd::Zero(Matrix_1.rows(), Matrix_1.cols()); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { //Matrix(i,j) = 0; for (int k = 0; k < n; k++) { Matrix(i, j) += Matrix_1(i, k) * Matrix_2(k, j); } } }
}
Eigen::MatrixXd calc_power(Eigen::MatrixXd Matrix, const int m, const int n) //计算次幂 ,m> 0; //m 为次方数 n为方阵维度 { if (m == 1) return Matrix; else { Eigen::MatrixXd Matrix_copy; //复制当前矩阵 Matrix_copy.resize(Matrix.rows(), Matrix.cols()); Matrix_copy = Matrix; // Matrix_copy = Eigen::MatrixXd::Zero(Matrix.rows(), Matrix.cols()); for (int i = 0; i < m - 1; i++) { Matrix = multi_matrix(Matrix, Matrix_copy, n); } return Matrix; } } //kron实现 Eigen::MatrixXd kron(Eigen::MatrixXd a,Eigen::MatrixXd b) { Eigen::MatrixXd p(a.rows()b.rows(),a.cols()b.cols()); for (int i=0;i<a.rows();i++) for (int j=0;j<a.cols();j++) for (int ii=0;ii<b.rows();ii++) for (int jj=0;jj<b.cols();jj++) { //行ib.row+ii,列jb.column+jj p(ib.rows()+ii,jb.cols()+jj)=a(i,j)b(ii,jj); } return p; } / Includes_END */
/ Externs_BEGIN / / extern double func(double a); / Eigen::Vector<double,Eigen::Dynamic> r; Eigen::Vector<double,Eigen::Dynamic> U;
/ Externs_END /
void Modelprective_Start_wrapper(real_T xD) { / Start_BEGIN / /
void Modelprective_Outputs_wrapper(const real_T x_r, const real_T y_r, const real_T yaw_r, real_T vx, real_T steer, const real_T xD) { / Output_BEGIN / / 此示例将输出设置为等于输入 y0[0] = u0[0]; 对于复信号,使用: y0[0].re = u0[0].re; y0[0].im = u0[0].im; y1[0].re = u1[0].re; y1[0].im = u1[0].im; /
// 为了转化为标准二次规划问题,进行矩阵转化 // 状态和控制合并为一个新的向量 Eigen::Vector<double,Eigen::Dynamic> kesi; kesi = Eigen::VectorXd::Zero(5,1); kesi << xD[0], xD[1], xD[2], U(0), U(1);
// Eigen::VectorXd f(61);
// Eigen::SparseMatrix A_cons(2230,230+1);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> A_cons;
A_cons = Eigen::MatrixXd::Zero(2230,230+1);
A_cons.block(0, 0, Nu Nc, Nu Nc)=A_I;
A_cons.block(0, 60, Nu Nc, 1)=p3;
A_cons.block(60, 0, Nu Nc, Nu Nc)=-A_I;
A_cons.block(60, 60, Nu Nc, 1)=p3;
// Eigen::VectorXd lb(2); Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> lb; lb = Eigen::MatrixXd::Zero(2,1); lb << delta_Umin,0;
// Eigen::VectorXd ub(2); Eigen::Vector<double, Eigen::Dynamic> ub; ub = Eigen::VectorXd::Zero(2,1); ub << delta_Umax,10;
// Eigen::Vector<double, Eigen::Dynamic> X; // double solve_quadprog(Eigen::Matrix<double,61,61>& H, Eigen::Vector<double,61>& f,const Eigen::Matrix<double,120,61>& A_cons, const Eigen::Vector<double,120>& b_cons, const Eigen::Matrix<double,2,1>& lb, const Eigen::Vector<double,2>& ub, Eigen::Vector<double,2>& X);
/ Output_END / }
void Modelprective_Update_wrapper(const real_T x_r, const real_T y_r, const real_T yaw_r, real_T vx, real_T steer, real_T xD) { / Update_BEGIN / sample = sample+T; r(0) = 25sin(0.2sample); r(1) = 35-25cos(0.2sample); r(2) = 0.2*sample;
/ Update_END / }
void Modelprective_Terminate_wrapper(real_T xD) { / Terminate_BEGIN / /
OsqpEigen::Solver::Solver()' E:/newcar/Modelprective_wrapper.cpp:361: undefined reference to
OsqpEigen::Solver::settings() const' E:/newcar/Modelprective_wrapper.cpp:361: undefined reference toOsqpEigen::Settings::setVerbosity(bool)' E:/newcar/Modelprective_wrapper.cpp:362: undefined reference to
OsqpEigen::Solver::settings() const' E:/newcar/Modelprective_wrapper.cpp:362: undefined reference toOsqpEigen::Settings::setWarmStart(bool)' E:/newcar/Modelprective_wrapper.cpp:365: undefined reference to
OsqpEigen::Solver::data() const' E:/newcar/Modelprective_wrapper.cpp:365: undefined reference toOsqpEigen::Data::setNumberOfVariables(int)' E:/newcar/Modelprective_wrapper.cpp:366: undefined reference to
OsqpEigen::Solver::data() const' E:/newcar/Modelprective_wrapper.cpp:366: undefined reference toOsqpEigen::Data::setNumberOfConstraints(int)' E:/newcar/Modelprective_wrapper.cpp:367: undefined reference to
OsqpEigen::Solver::data() const' E:/newcar/Modelprective_wrapper.cpp:369: undefined reference toOsqpEigen::Solver::data() const' E:/newcar/Modelprective_wrapper.cpp:369: undefined reference to
OsqpEigen::Data::setGradient(Eigen::Ref)' E:/newcar/Modelprective_wrapper.cpp:371: undefined reference toOsqpEigen::Solver::data() const' E:/newcar/Modelprective_wrapper.cpp:373: undefined reference to
OsqpEigen::Solver::data() const' E:/newcar/Modelprective_wrapper.cpp:373: undefined reference toOsqpEigen::Data::setLowerBound(Eigen::Ref)' E:/newcar/Modelprective_wrapper.cpp:375: undefined reference to
OsqpEigen::Solver::data() const' E:/newcar/Modelprective_wrapper.cpp:375: undefined reference toOsqpEigen::Data::setUpperBound(Eigen::Ref)' E:/newcar/Modelprective_wrapper.cpp:379: undefined reference to
OsqpEigen::Solver::initSolver()' E:/newcar/Modelprective_wrapper.cpp:384: undefined reference toOsqpEigen::Solver::solveProblem()' E:/newcar/Modelprective_wrapper.cpp:391: undefined reference to
OsqpEigen::Solver::getSolution()' C:\Users\zhouh\AppData\Local\Temp\mex_58524969571628_4908\Modelprective_wrapper.obj: In functionbool OsqpEigen::Data::setHessianMatrix(Eigen::SparseCompressedBase const&)': E:/C++/osqp-eigen/include/OsqpEigen/Data.tpp:16: undefined reference to
OsqpEigen::debugStream()' E:/C++/osqp-eigen/include/OsqpEigen/Data.tpp:23: undefined reference toOsqpEigen::debugStream()' E:/C++/osqp-eigen/include/OsqpEigen/Data.tpp:31: undefined reference to
OsqpEigen::debugStream()' E:/C++/osqp-eigen/include/OsqpEigen/Data.tpp:40: undefined reference toOsqpEigen::debugStream()' C:\Users\zhouh\AppData\Local\Temp\mex_58524969571628_4908\Modelprective_wrapper.obj: In function
bool OsqpEigen::Data::setLinearConstraintsMatrix(Eigen::SparseCompressedBase const&)': E:/C++/osqp-eigen/include/OsqpEigen/Data.tpp:52: undefined reference toOsqpEigen::debugStream()' C:\Users\zhouh\AppData\Local\Temp\mex_58524969571628_4908\Modelprective_wrapper.obj:E:/C++/osqp-eigen/include/OsqpEigen/Data.tpp:59: more undefined references to
OsqpEigen::debugStream()' follow C:\Users\zhouh\AppData\Local\Temp\mex_58524969571628_4908\Modelprective_wrapper.obj: In function `std::default_deleteOsqpEigen::Settings::~Settings()' C:\Users\zhouh\AppData\Local\Temp\mex_58524969571628_4908\Modelprective_wrapper.obj: In function
std::default_deleteOsqpEigen::Data::~Data()' C:\Users\zhouh\AppData\Local\Temp\mex_58524969571628_4908\Modelprective_wrapper.obj: In function
bool OsqpEigen::SparseMatrixHelper::createOsqpSparseMatrix(Eigen::SparseCompressedBase const&, csc&)': E:/C++/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp:30: undefined reference toOsqpEigen::debugStream()' E:/C++/osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp:35: undefined reference to
csc_spalloc' collect2.exe: error: ld returned 1 exit status