Open WillieMaddox opened 5 years ago
From what I can gather, the former is a cascaded P + P controller, while the latter is a PD controller. As you demonstrate, they can basically be transformed into each other with different values for the constants.
The former (cascaded P-P) is the one to which the advice in the notes applies, that kpVelXY should be about 3 to 4 times kpPosXY, I think.
The latter can use the "usual" rule of thumb that k_d (that is, kpVelXY) should around 1.7 to 2 times sort(k_p).
It's all a bit messed up, at any rate.
There is a math error in
QuadControl::LateralPositionControl().
Specifically,velCmd += kpPosXY * (posCmd - pos);
andaccelCmd += kpVelXY * (velCmd - vel);
If you combine these you end up with,accelCmd += kpVelXY * (velCmd - vel + kpPosXY * (posCmd - pos));
which almost looks right but is incorrect. The correct answer is,accelCmd += kpVelXY * (velCmd - vel) + kpPosXY * (posCmd - pos);