How to use quaternions for servomotors?

I created a robotic arm. And I want to learn to control it by capturing movements from my arm. I have several BNO055. I got quaternions of motion from these sensors. I don't know how I can use quaternions to control servos in a robotic arm. And how can I combine values from multiple sensors to control biceps, forearms and hands.

I got the code for the project here: MotioSuit/MotioSuit.ino at master · alvaroferran/MotioSuit · GitHub

I managed to control the 3D model in the blender. But there are special functions for rotating vectors in space. How do I rotate a robotic arm using servomotors?


I attached a schematic representation of my robotic arm. As well as images of the placement of sensors to capture hand movements.

If I get quaternions from each sensor, how do I properly process them into Euler angles?

1 Like

The difference in orientation is obtained by multipling one quarternion by the inverse of the other. The difference between two orientations either side of a joint will be the rotation at that joint, you can simply pull off the magnitude of the angle direct from the quaternion as its scalar part is cos(w/2) and the magnitude of the vector part is sin(w/2), so w = 2*atan2(|v|, s)
(where the quaternion is (s, vx, vy, vz), and w is the angle)

1 Like