Closed Tengyun-Mo closed 7 months ago
I am using a fedora system. I tried installing mpc and have it, but I cannot find MPC.h and Fedora does not seem to have a development version of mpc; i.e.,
cppad_issue>sudo dnf install mpc-devel
Last metadata expiration check: 0:04:44 ago on Fri 09 Oct 2020 10:13:22 AM MST.
No match for argument: mpc-devel
Error: Unable to find a match: mpc-devel
Can you remove mpc from the example ?
I am using a fedora system. I tried installing mpc and have it, but I cannot find MPC.h and Fedora does not seem to have a development version of mpc; i.e.,
cppad_issue>sudo dnf install mpc-devel Last metadata expiration check: 0:04:44 ago on Fri 09 Oct 2020 10:13:22 AM MST. No match for argument: mpc-devel Error: Unable to find a match: mpc-devel
Can you remove mpc from the example ?
Thanks for you response,I try the demo of Ipopt,and everything is ok.I think maybe something wrong with input vector.there is the mpc.h:
#ifndef MPC_H
#define MPC_H
#include <vector>
#include <map>
#include "Eigen-3.3/Eigen/Core"
using namespace std;
class MPC {
public:
MPC();
vector<double> mpc_x;
vector<double> mpc_y;
void LoadParams(const std::map<string, double> ¶ms);
// Solve the model given an initial state and polynomial coefficients.
// Return the first actuations.
vector<double> Solve(Eigen::VectorXd state, Eigen::VectorXd coeffs);
virtual ~MPC();
private:
// Parameters for mpc solver
double _max_steering, _max_throttle, _bound_value;
int _mpc_steps, _x_start, _y_start, _psi_start, _v_start, _cte_start, _epsi_start, _delta_start, _a_start;
std::map<string, double> _params;
};
#endif /* MPC_H */
I put your MPC.h at the front inline with at the top of the rest of your program in a file called junk.cpp and tried to compile it. I got the following errors:
g++ -g -O0 junk.cpp -o junk -I /home/bradbell/prefix/cppad/include -I /home/bradbell/prefix/cppad/eigen/include -L/home/bradbell/prefix/cppad/lib64 -lipopt
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o: in function _start': (.text+0x24): undefined reference to
main'
/usr/bin/ld: /tmp/cc7Ypp7b.o: in function MPC::MPC()': /home/bradbell/trash/cppad_issue/junk.cpp:188: undefined reference to
vtable for MPC'
I put your MPC.h at the front inline with at the top of the rest of your program in a file called junk.cpp and tried to compile it. I got the following errors:
g++ -g -O0 junk.cpp -o junk -I /home/bradbell/prefix/cppad/include -I /home/bradbell/prefix/cppad/eigen/include -L/home/bradbell/prefix/cppad/lib64 -lipopt /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o: in function
_start': (.text+0x24): undefined reference to
main' /usr/bin/ld: /tmp/cc7Ypp7b.o: in functionMPC::MPC()': /home/bradbell/trash/cppad_issue/junk.cpp:188: undefined reference to
vtable for MPC'
I made a demo to test mpc.cpp,and mpc.cpp is ok.There is the demo(maybe you should change some code in my demo,because I run the code in ROS):
#include <iostream>
#include <map>
#include <math.h>
#include <stdio.h>
#include "ros/ros.h"
#include "MPC.h"
#include <Eigen/Core>
#include <Eigen/QR>
using namespace std;
using namespace Eigen;
int main(int argc, char **argv)
{
//Initiate ROS
ros::init(argc, argv, "MPC_Node");
MPC mpc;
VectorXd state(6);
VectorXd coeffs(4);
state << 0.394202, 0.0, 0.0, 3.94202, 0.743441, -0.0021541;
coeffs << 0.744287, 0.00214534, 0.005139, 0.000007821;
while(ros::ok()){
vector<double> mpc_results = mpc.Solve(state, coeffs);
}
return 0;
}
Maybe I know where is the problem,It's an environmental configuration issue.After I reinstall ipopt package,everything is perfect.Thanks for your help @bradbell,I'm very appreciate it!
Are there any considerations I need to take when I run that on ROS? I am facing the same troubles and reinstalling didn't change any thing!
Is there someway I can reproduce your problem; e.g., clone a specific git repository and execute a specific stet of steps ?
The result of function
CppAD::ipopt::solve<Dvector, FG_eval>( options, vars, vars_lowerbound, vars_upperbound, constraints_lowerbound,constraints_upperbound, fg_eval, solution)
is null.And I don't know what cause this.Does anyone knows what can cause the result is null?I'm very appreciate it .This is the code: