# Quaternion error in one degree of freedom

I would like to control a system which orientation I measure with as quaternion based EKF in one degree of freedom. Obviously the simplest thing would be to convert the quaternion estimate to euler angles and take one of these. Unfortunately these euler angles are not stable. The other option I was thinking about was to use the so called quaternion error, where I specify another quaternion which I want my system to be controlled towards. Then I would have to specify all four values of this quaternion.

I'm wondering if there is a way to generate a quaternion error only for one of my angles?

You will have to specify the full quaternion in any case and that is because each w,x,y and z are a function of all the Euler angles.

Some ways to get by could be:

1. If you are concerned about an EKF generating noisy output in the other two angles: in the update step, you can hard code these known angles

2. If you want to control just one angle: just extract one single value of this rotation (Euler angle would be your best bet) or extract the entire quaternion from this EKF and find the error with the desired angle or the quaternion.

Your desired quaternion should not be difficult to calculate since you either want the robot to be same in the other two angles or you know the desired angles already.

Note : if you deal with Euler angles, you will have to be careful of the gimbal lock problem (singularity) which should not be very difficult to overcome.

If your system has a fixed rotation about some axis, then you should be able to design your KF about a single angle of rotation. You should be able to tailor your equations of motion and measurements to be a function of that angle.