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

Code generation issues with MX #98

Closed alphaville closed 4 years ago

alphaville commented 4 years ago

Follow up from #97: When MX symbols are used instead of SX, CasADi generates C functions with four inputs and two outputs (should be two inputs, one output).

CASADI_SYMBOL_EXPORT 
int phi_ouwuhTtcvhAgzouqLDHE_work(
    casadi_int *sz_arg, 
    casadi_int* sz_res, 
    casadi_int *sz_iw, 
    casadi_int *sz_w) {
  if (sz_arg) *sz_arg =  4; // Should be 2
  if (sz_res) *sz_res = 2; // Should be 1
  if (sz_iw) *sz_iw = 0;
  if (sz_w) *sz_w = 15;
  return 0;
}

The rest of the Rust-to-C API assumes that CasADi function take two input arguments and return two output arguments, so we get memory problems.