uzh-rpg / rpg_mpc

Model Predictive Control for Quadrotors with extension to Perception-Aware MPC
GNU General Public License v3.0
367 stars 94 forks source link

MPC reference inputs #7

Closed zhangbaozhe closed 1 year ago

zhangbaozhe commented 1 year ago

Hey guys, I've been using your library for our project. When I edit the code, I found that in the MpcController class, the method setReference also computes reference inputs. For example, here.

I am wondering, how's the performance if I do not compute any reference inputs and only set them to zeros. Will the optimization still converge?

I'm debugging right now, and I have set them to zero. I do not know if this is a critical point for the performance of the whole controller.

Thanks

foehnx commented 1 year ago

hmm, I think if you leave the inputs at zero it might converge but the problem is a bit malformed. See, for most accelerations you will need non-zero thrusts (inputs). If you set them just to zero then you basically change the cost term on inputs to minimize them, what might result in suboptimal control performance. Effectively, this will trade-off the costs to [minimize thrusts (inputs)] <--against--> [minimize all other tracking errors].

zhangbaozhe commented 1 year ago

Thanks for the quick reply.

I have run your code in PX4 sitl simulation to let the quadrotor follow a circle without the input references, and the result is good. However, now in our project, the state dimension reaches to 23, I want to let the quadrotor take off to a certain point (say (0,0,5) point) with other references setting to zeros or identities (the quaternions). I am not sure if ACADO can handle the optimal problem now. The behavior of this experiment is that after the quadrotor fly to the point at z = 5m, it becomes unstalbe and will drift to a certain direction and crash. I don't know if it is a problem of the ACADO side.

Could you please share some general hints or suggesstions using ACADO?