I want to control the attitude(roll, pitch, yaw) of a vehicle capable of pitching and rolling. To do this I have created a quaternion PID controller. First I take the current attitude of the vehicle converting it to a quaternion Qc and do the same for the desired attitude with the quaternion Qd. I then calculate the input of my PID controller as Qr = Qc' x Qd. The imaginary parts of the quaternions are then fed as force requests on the roll, pitch, yaw axes of the vehicle. I test on a simulator and the control works but becomes unstable in some cases (request for R: 60 P: 60 Y:60). I also want this to work around singularities (i.e. pitch 90)

Does anyone know why I get this behavior and if so explain (thoroughly) what I'm doing wrong?


You are using one PID controller to try to drive a quaternion? A quaternion by definition represents three degrees of freedom, roll pitch yaw, and a PID controller is Single Input, Single Output (SISO) controller.

You're trying to mask a Multiple Input, Multiple Output (MIMO) system by hiding your three variables in a quaternion.

I would suggest maybe you consider using three PID controllers. If you're concerned about singularities, try going for an axis-angle configuration, where two controllers drive the azimuth and elevation of the axis and a third drives the rotation.

  • $\begingroup$ Sorry for the misunderstanding I am already using a PID controller per axis (Roll, Pitch, Yaw) which means 3 controllers in total. $\endgroup$ – MrHat Sep 8 '15 at 9:41
  • $\begingroup$ Nevermind in the end it was just a silly bug to do with the way I was transforming euler angles to quaternions. Thanks for the suggestion though. $\endgroup$ – MrHat Sep 8 '15 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.