Algebraic state vector or External cost function

Hi,

I’m using acados for NMPC in C. I want to formulate the kinematic model of a robot manipulator. I set the state vector x as the joint position and input vector u as the joint velocity. So the system model is linear and quite simple now. I want to minimize the tracking error of end-effector in cost function. Expressing the end-effector state involves a nonlinear function of x.

I am considering two options. The first one is setting algebraic state vector z as the end-effector state and using linear least squares cost function. But it will make the dynamics complex. The other is using a external cost function to express the end-effector state with x and not using algebraic state vector z. I wonder which approach would be more effective for solving this problem.

Thank you.

Hi,

I think both approaches are valid.
The approach of having the expression just in the cost might have some advantages:

I would be interested to hear if one of the two options work better for you or if you see other advantages with one of the two approaches.

Best,
Jonathan