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)) self.name = "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)
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!