Jump to content
Sign in to follow this  
Rei Vilo

[Energia Library] Matrix for LaunchPad, FraunchPad and StellarPad

Recommended Posts

Please find the port of a matrix library from Arduino.

 

I tested the library on the LaunchPad MSP430G2553, FraunchPad MSP430FR5739 and StellarPad LM4F120H5QR.

 

 

 

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.

 

***
FraunchPad ADXL335 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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×