43oh

## Recommended Posts

Please find the port of a matrix library from Arduino.

Created by Charlie Matlack on 12/18/10. Changed name.
Original code by RobH45345 on Arduino Forums, taken from unknown source.

Rei Vilo - Feb 04, 2013 - Revised library with examples
Rei Vilo - Jan 26, 2013 - Initial port to Energia
Rei Vilo - Feb 04, 2013 - Revised library with examples

Includes an example for the calibration of the FraunchPad accelerometer.

```***
All measures are in g.
Press PUSH2 when invited by ...

Pesent the accelerometer as indicated...
flat            ...     -0.01   -0.07   1.07    1.00
reverse         ...     -0.02   -0.07   -0.97   1.00
right           ...     1.00    -0.09   0.08    1.00
left            ...     -1.03   -0.04   -0.06   1.00
up              ...     -0.12   -1.12   0.03    1.00
down            ...     0.03    0.98    0.03    1.00

2. Gains and offsets calculation
Wt
Wt*W
(Wt*W)^-1
(Wt*W)^-1 * Wt
(Wt*W)^-1 * Wt * Y

3. Results
Output> gX      gY      gZ
x gain  -0.03   0.98    -0.07
y gain  -0.95   -0.07   0.00
z gain  -0.00   -0.00   0.98
offset  -0.07   0.02    -0.03

// Formulas
gX =  x/-39.28 + y/-1.05 + z/-344.39 + 1/-14.90;
gY =  x/1.02 + y/-14.61 + z/-223.73 + 1/53.06;
gZ =  x/-14.99 + y/333.11 + z/1.02 + 1/-34.13;

4. Tests
...
Input raw g     -0.02   -0.08   1.02
Calculated g    0.01    0.00    0.97
...
Input raw g     -0.05   -0.17   1.17
Calculated g    0.09    -0.02   1.12
...
Input raw g     -0.02   -0.07   1.02
Calculated g    -0.00   -0.00   0.97
...
Input raw g     -0.04   -0.16   1.14
Calculated g    0.08    -0.01   1.09
...
Input raw g     -0.02   -0.08   1.02
Calculated g    0.01    0.00    0.97
...
```

MatrixMath_Distribution.zip

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
• Blog

• #### Activity

×
• Create New...