meco-group / omg-tools

Optimal Motion Generation-tools: motion planning made easy
GNU Lesser General Public License v3.0
565 stars 98 forks source link

Build exported code from `formation_holonomic_export.py` #86

Closed EnricaSo closed 4 years ago

EnricaSo commented 4 years ago

Hi! Thank you for sharing this work, it's wonderful!

I'm trying to export the formation_holonomic_export.py example and build it to an executable, but I'm getting into some troubles. The export works properly: I get a folder export_f with the src code, the instructions.txt and a Makefile.

In the Makefile I replace the content of these variables (where *** is the path to where I cloned omg-tools):

CASADILIB = ***/omg-tools/venv/local/lib/python2.7/site-packages/casadi/casadi
CASADIINC = ***/omg-tools/venv/local/lib/python2.7/site-packages/casadi/include/
CASADIOBJ = ***/omg-tools/examples/export_f/bin/

Then, from the dir export_f I issue the command make and I get the following error:

In function `omgf::Point2Point::solve(double, std::vector<omgf::obstacle, std::allocator<omgf::obstacle> >&)':
Point2Point_omgf.cpp:(.text+0x2507): undefined reference to `casadi::Function::stats[abi:cxx11](int) const'
collect2: error: ld returned 1 exit status
Makefile:66: recipe for target 'bin/FormationPoint2Point' failed
make: *** [bin/FormationPoint2Point] Error 1

If I go to the definition of Point2Point::generateProblem() I see that it requires nlp.so to be present in the path CASADIOBJ. However, in CASADIOBJ I have no such a file. I'm using casadi 3.5.1 that I installed with pip.

Am I doing something wrong? Is there any other documentation for exporting c++ code from omg-tools?

Thank you in advance!

jgillis commented 4 years ago

Try with gcc-4

EnricaSo commented 4 years ago

I've just tried with gcc and g++ version 4.9.3 and I get similar errors:

 In function `omgf::ADMMPoint2Point::generateProblem()':
ADMMPoint2Point_omgf.cpp:(.text+0xbfb): undefined reference to `casadi::GenericType::GenericType(std::string const&)'
ADMMPoint2Point_omgf.cpp:(.text+0xda7): undefined reference to `casadi::nlpsol(std::string const&, std::string const&, std::string const&, std::map<std::string, casadi::GenericType, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::GenericType> > > const&)'
ADMMPoint2Point_omgf.cpp:(.text+0xe6e): undefined reference to `casadi::external(std::string const&, std::string const&, std::map<std::string, casadi::GenericType, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::GenericType> > > const&)'
ADMMPoint2Point_omgf.cpp:(.text+0xf08): undefined reference to `casadi::external(std::string const&, std::string const&, std::map<std::string, casadi::GenericType, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::GenericType> > > const&)'
ADMMPoint2Point_omgf.cpp:(.text+0xf9f): undefined reference to `casadi::external(std::string const&, std::string const&, std::map<std::string, casadi::GenericType, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::GenericType> > > const&)'
obj/ADMMPoint2Point_omgf.o: In function `omgf::ADMMPoint2Point::solveUpdx(double, std::vector<omgf::obstacle, std::allocator<omgf::obstacle> >&)':
ADMMPoint2Point_omgf.cpp:(.text+0x2134): undefined reference to `casadi::Function::operator()(std::map<std::string, casadi::Matrix<double>, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::Matrix<double> > > > const&) const'
ADMMPoint2Point_omgf.cpp:(.text+0x21a2): undefined reference to `casadi::Function::stats(int) const'
obj/ADMMPoint2Point_omgf.o: In function `casadi::GenericType::operator std::string() const':
ADMMPoint2Point_omgf.cpp:(.text._ZNK6casadi11GenericTypecvSsEv[_ZNK6casadi11GenericTypecvSsEv]+0x1f): undefined reference to `casadi::GenericType::to_string() const'
obj/Point2Point_omgf.o: In function `omgf::Point2Point::generateProblem()':
Point2Point_omgf.cpp:(.text+0xead): undefined reference to `casadi::GenericType::GenericType(std::string const&)'
Point2Point_omgf.cpp:(.text+0x104d): undefined reference to `casadi::nlpsol(std::string const&, std::string const&, std::string const&, std::map<std::string, casadi::GenericType, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::GenericType> > > const&)'
obj/Point2Point_omgf.o: In function `omgf::Point2Point::generateSubstituteFunctions()':
Point2Point_omgf.cpp:(.text+0x137f): undefined reference to `casadi::external(std::string const&, std::string const&, std::map<std::string, casadi::GenericType, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::GenericType> > > const&)'
Point2Point_omgf.cpp:(.text+0x14b3): undefined reference to `casadi::external(std::string const&, std::string const&, std::map<std::string, casadi::GenericType, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::GenericType> > > const&)'
obj/Point2Point_omgf.o: In function `omgf::Point2Point::solve(double, std::vector<omgf::obstacle, std::allocator<omgf::obstacle> >&)':
Point2Point_omgf.cpp:(.text+0x23ce): undefined reference to `casadi::Function::operator()(std::map<std::string, casadi::Matrix<double>, std::less<std::string>, std::allocator<std::pair<std::string const, casadi::Matrix<double> > > > const&) const'
Point2Point_omgf.cpp:(.text+0x2439): undefined reference to `casadi::Function::stats(int) const'
collect2: error: ld returned 1 exit status
Makefile:66: recipe for target 'bin/FormationPoint2Point' failed
make: *** [bin/FormationPoint2Point] Error 1
EnricaSo commented 4 years ago

Hello! It works out of the box with python3.5, casadi3.5.1 and g++4.9 (I was using python2.7 above)

Thank you