Cant get getter for "p" to work

Hi :wave: ,

In acados v0.2.6 the getter for ā€œpā€ was introduced in the c interface. Im using it as follows:

First I do:

  double p[NP];
  std::copy(std::begin(model_params), std::end(model_params), p);
  for (int i = 0; i < UAV_N; i++) { uav_acados_update_params(acados_ocp_capsule_, i, p, NP); }

And then:

 std::array<double,MHE_NP> parameters;
 ocp_nlp_get_at_stage (acados_ocp_capsule_->nlp_config, acados_ocp_capsule_->nlp_dims, acados_ocp_capsule_->nlp_solver, index, "p", &parameters);

This does not give the expected result. Can someone help me? Thanks in advance!

@FreyJo I think you made a small mistake in one of your recent commits:

else if (!strcmp(field, "p"))
{
    if ((size1 != nx) || (size2 != 1))
    {
        printf("\nocp_qp_hpipm_solver_get: size of field %s not as expected, got size %d %d.\n",
               field, size1, size2);
    }
    d_ocp_qp_ipm_get_ric_p(qp_in, opts->hpipm_opts, mem->hpipm_workspace, stage, double_values);
}

Note that size1 checks for nx instead of np.

Hi Rinto,

this is not a bug, the getter is written for the p in the Riccati factorization of HPIPM.
It might make sense to clarify the name though.

The parameters are supposed to be set with the generated update_params function, as you wrote.
And there is no getter implemented for them.

Cheers!

Thanks for your quick reply (and in general for the active development/ support on acados!)! Sorry for the (in hindsight) silly question.

1 Like