rotate a quaternion
I have a quaternion that represents the orientation of the robot gripper. Now, I want to define a set of primitive actions to change this orientation in some directions, so that all possible orientations are reachable (to some accuracy).
My solution is to convert quaternions into Euler angles, then add a certain amount (say 10 degrees) to one of the three angles, and convert back to quaternions. This worked quite well as I thought but had the problem of gimbal lock.
So here is my question. Is there a way to achieve the behaviour obtained here, without converting back and forth between quaternions and Euler angles?
====================================================
EDIT: From some tutorials, I learn that I can apply a rotation quaternion q to a orietation quaternion v to obtain a new orietation quaternion v'=qvq*. So my question is, given v=(w,x,y,z), what are the q's that only change its pitch, roll and yaw respectively?
After some thinking, I get the following:
yaw: (cos(alpha),0,0,sin(alpha))
roll: (cos(alpha),x,y,z) --> normalization
pitch: (cos(alpha),y,-x,0) --> normalization
Am I right?