The Build
The build is simply made of 4 principal parts:
- 1 wooden ball
- 3 retractable key reels
- 3 analog 2-axis joysticks
- 1 microcontroller (teensy-lc)
The wooden ball is attached to the strings of three key reels. The potentiometers of the joysticks measure the angle formed by each string. The resulting values are transmitted by the microcontroller to the laptop via usb. A python program calculate in real time the exact position of the wooden ball from these values.
The result is a position that encode the rotation and the translation of the object.
The Maths
The python program has to calculate the position P of the wooden ball from the received angles The function that do this task is known as forward kinematics (FK). Its inverse, that calculate the six angles from a given position, is called the inverse kinematics (IK). I was not able to calculate the FK with the configuration of this build. Although, the IK is straightforward to calculate. So the task of the python program is to numerically invert IK to get FK.
There exist various way to encode a position P of a rigid body like the wooden ball. I choose to use unit quaternions to encode the rotation part and vectors for the translation part. The mathematical space of all possible positions P is named SE(3). This space has six dimensions (three for the rotation part and three for the translation part). Although, it is not a linear space due to the rotation part.
To get the numeric inverse of a function f: A -> B with a method like the Newton's one, the spaces A and B must be linear spaces. Since SE(3) is a curved space, we need to "linearize" it to use the Newton method on IK. This is achieved by using a special form of the exponential map :
The set se(3) represent the tangent space to SE(3). This tangent space has also six dimensions and it is linear! So the exponential map sends vectors of dimension 6 to the curved space SE(3) in a very smooth way.
Now we have everything necessary to calculate the forward kinematic FK
I don't supposed you could be persuaded to make it emulate an HID device, could you? :grin: https://www.kickstarter.com/projects/2010925172/overload-the-ultimate-six-degree-of-freedom-shoote