alphaville / optimization-engine

Nonconvex embedded optimization: code generation for fast real-time optimization + ROS support
https://alphaville.github.io/optimization-engine/
Other
499 stars 53 forks source link

ROS CMakefile template #149

Closed gmsanchez closed 4 years ago

gmsanchez commented 4 years ago

Hi! I've been able to migrate a MHE problem that I had running on IPOPT to OpEn. So far so good, I am able to get results in less than a millisecond!

The next step should be to use the generated C code with roscpp in a ROS C++ node. Is there any template or example on how to configure the CMakefile (using cmake or cmake_simple)?

Thanks in advance!

alphaville commented 4 years ago

Hi @gmsanchez. This is great news.

OpEn can generate C/C++ bindings if you compile using the setting .with_build_c_bindings() as discussed in the documentation. For that you need to install clang, which is a requirement of cbindgen.

OpEn will generate C bindings as well as an example C file. You may then modify this file. Compiling and linking is easy, but I think it would be a very good idea for OpEn to auto-generate a cmake file as well.

alphaville commented 4 years ago

@gmsanchez I created a pull request (#152) to address this issue. As a first step, I am auto-generating a CMakeLists file that allows you to compile the auto-generated example C file. Once you compile using with_build_c_bindings(), you can do:

cmake .
make run

to run the auto-generated example.

This is a first-step to an auto-generated ROS node.

alphaville commented 4 years ago

Note: See ros_optimization_engine

alphaville commented 4 years ago

First implementation: https://github.com/alphaville/open_ros

It remains to make Jinja2 templates and support automatic code generation for ROS packages