ACADOS Python External Cost

Hi everyone,

Maybe this is something that @FreyJo or @zanellia can tackle.

I am using Python to generate c_code with an external cost function. In particular, I’m initalizing the class attached to this issue report, where the model variable holds:

        self.x = ca.vertcat(ca.MX.sym('x', self.n, 1))
        self.u = ca.vertcat(ca.MX.sym('u', self.m, 1))
        self.xdot = ca.vertcat(ca.MX.sym('xdot', self.n, 1)) = "astrobee"
        self.f_expl = self.astrobee_dynamics(self.x, self.u)
        self.f_impl = self.xdot - self.f_expl
        self.z = []
        self.disc_dyn_expr = self.rk4_integrator(self.astrobee_dynamics)

Code: AcadosGenerator , CppTest

What I found out is that if P is not zero, then the system has a wrong behavior (it tries to go to the desired setpoint, but then goes back).

Is there something wrong with the implementation, or is it some bug with the code generation?

Thank you for all the input!

Hi @PRoque

I just wanted to look into your issue.
Unfortunately, the files you linked are down.
Did you solve the issue yourself?

Also, it would be convenient if you can make the example more minimal, ideally just in Python.


@PRoque and I had a nice discussion about his control task and the issue, thanks! :pray:
We were able to find the bug.
I just merged it into the master branch, see this PR

and this commit
1 Like