robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
393 stars 117 forks source link

osqp-eigen not compatible with osqp 0.6.0 #31

Closed GiulioRomualdi closed 5 years ago

GiulioRomualdi commented 5 years ago

osqp-eigen is not compatible with the latest version of osqp (0.6.0) https://github.com/oxfordcontrol/osqp/pull/170 The incompatibility is caused by the following two commits:

  1. https://github.com/oxfordcontrol/osqp/commit/78d11351555d6d4b0445a8d65d1066bb47df3b00 osqp_setup now returns an exit flag instead of OSQPWorkspace*

    diff --git a/include/osqp.h b/include/osqp.h
    index 4a25388f..8ced8cac 100644
    --- a/include/osqp.h
    +++ b/include/osqp.h
    @@ -50,12 +50,12 @@ void osqp_set_default_settings(OSQPSettings *settings);
    * NB: This is the only function that allocates dynamic memory and is not used
    *during code generation
    *
    + * @param  work         Solver workspace
    * @param  data         Problem data
    * @param  settings     Solver settings
    - * @return              Solver environment
    + * @return              Exitflag for errors (0 if no errors)
    */
    -OSQPWorkspace* osqp_setup(const OSQPData *data,
    -                          OSQPSettings   *settings);
    +c_int osqp_setup(OSQPWorkspace** work, const OSQPData* data, const OSQPSettings* settings);
    
    # endif // #ifndef EMBEDDED
  2. https://github.com/oxfordcontrol/osqp/pull/170/commits/06678c794eaf78afd448414e6ad1c8fb5b9b3ab0 osqp now accepts only upper triangular Hessian matrices

    diff --git a/src/osqp.c b/src/osqp.c
    index c5508f0f..1d4ef186 100644
    --- a/src/osqp.c
    +++ b/src/osqp.c
    @@ -111,7 +111,7 @@ c_int osqp_setup(OSQPWorkspace** work, const OSQPData *data, const OSQPSettings
    (*work)->data    = c_malloc(sizeof(OSQPData));
    (*work)->data->n = data->n;                    // Number of variables
    (*work)->data->m = data->m;                    // Number of linear constraints
    -  (*work)->data->P = csc_to_triu(data->P);       // Cost function matrix
    +  (*work)->data->P = copy_csc_mat(data->P);      // Cost function matrix
    (*work)->data->q = vec_copy(data->q, data->n); // Linear part of cost function
    (*work)->data->A = copy_csc_mat(data->A);      // Linear constraints matrix
    (*work)->data->l = vec_copy(data->l, data->m); // Lower bounds on constraints