This is a mechanical navball for a custom KSP gamepad
currently it can be assembled but the wheel have nylon wheel and are too slippery. I'm experimenting with wheel made out of TPU but I need something even more rubbery and sticky. Regarding the software the main idea is here and the ball move but due to the slippage it's hard to tell if the code is doing it's job or if I fucked up the math to get the transform. (plus it definitely need some tunning) anyways, feel free to build it and help me iron out the kink :)
Ball slippage, omniwheel grip issue. I need to find a way to make the wheel more sticky and ruberry so that it works correctly.
QTY | Name | Link | total price |
---|---|---|---|
25X | M3 5 mm depth 4.5mm diamater heat insert | https://www.aliexpress.com/item/1005003582355741.html | 3.5$ |
25X | M3 screw | ||
3X | omniwheel | https://www.aliexpress.com/item/32960657744.html | 8$ |
3X | DC motor | https://www.aliexpress.com/item/33022320164.html | 7$ |
2X | Hbridge DRV8833 | https://www.aliexpress.com/item/1005006444609771.html | 2.5$ |
1X | 3 axis magnetometer | 4.5$ | |
1X | magnet cylinder 10x2mm | https://www.aliexpress.com/item/1005006362930902.html | 2$ |
1X | arduino nano | https://www.aliexpress.com/item/1005005702204423.html | 2.5$ |
Total = ~30 $ + 3D printed part + transparent window |
one laser cutted sheet of 5mm transparent material is required. It should be engraved with the center sign of the navball. the plastic part should not require any support and can be printed on a 15 x 15 [cm] bed you will find the required file to print in the folder ToPrint, same for the folder toCut
need to document
https://kerbalsimpitrevamped-arduino.readthedocs.io/en/latest/payloadstructs.html#structvessel_pointing_message https://www.instructables.com/KerbalController-a-Custom-Control-Panel-for-Rocket/
The sphere is 90 mm in diameter the wheel are 50 mm in diameter the wheel are 120° apart (see from the top) and 45° raised from the horizontal plane
To compute the required motor commande
- finding the required rotation to go from the current navball orientation to the target one.
- project this rotation on the wheels so that we know how much to rotate each motor.
this is solved using quaternion. We know two things :
- the ball current orientation in the form of a unitary quaternion
$(c_0, c_1, c_2, c_3)$ and - the target orientation in the form of a unitary quaternion
$(t_0, t_1, t_2, t_3)$
from theses we know that there must exist a unitary quaternion such that $q \cdot c = t $ and thus we can deduce
we use linear algebra to project the quaternion axis on the axis of each motor. then we scale this by the required rotation.
first we can precompute the vector basis on which we are going to project the rotation (3 vector that represent the rotation made by the three omniwheel) we have our motor raised 45° from the horizontal plane. the unit axis for the first motor is thus :
then we apply a
we know that there must be a vector
thus if we invert the matrix M we get :
$$
= \frac{1}{9} \begin{bmatrix}
10 & -2 & -2 \
-2 & 10 & -2 \
-2 & -2 & 10
\end{bmatrix}.
$$
this matrix is computed once and stored in the code and the problem can now be easily solved using a matrix product
Now we convert the Quaternion to Rotation Vector to get w
$$ \text{Given } \mathbf{q} = (q_0, q_1, q_2, q_3),
\begin{aligned} \text{Rotation angle:} \ \theta &= 2 \arccos(q_0). \ \text{Rotation axis (normalized):} \ \mathbf{v} &= \frac{1}{\sqrt{1 - q_0^2}} \begin{bmatrix} q_1 \ q_2 \ q_3 \end{bmatrix}. \ \text{Rotation vector:} \ \mathbf{w} &= \theta \mathbf{v}. \end{aligned} $$ (we get w by encoding the ammoung of rotatation into v the unitary axis vector.
we have a magnetometer and a magnet embeded in the sphere, how to calibrate and then deduce the sphere orientation from the magnetic field felt by the magnetometer ?