PDA

View Full Version : ARCSIN function



mjphillips1981
- 4th March 2009, 16:35
Is there anyway to calculate an ARCSIN in PBP? I am trying to use an accelerometer to determine velocity of an arm moving in an arc. My problem with using the direct output of the accelerometer is that it is a function of SIN. If I can convert the numbers to an angle I will have a linear relationship. Can anyone help?

aratti
- 4th March 2009, 18:25
A very good approximation is given by this polynomial.

arcsin(x) = pi/2 - sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3)

where constant are as follow:
a0 = 1.5707288
a1 = -0.2121144
a2 = 0.0742610
a3 = -0.0187293

Tray it and see if this polynomial will solve your problem.

Al.

aratti
- 5th March 2009, 11:06
I have been thinking to a simpler way to solve your problem, and I came to the conclusion that you should use XY coordinates to trace the point on the arc where your arm moves. Your accellerometer gives you the sin value of the move than you read position zero= X0Y0 and position one = X1Y1 after the move, and so you have the possibility to linearise your data.

You can calculate the XY coordinate with this equation:

X= R * Sin
Y= R * sqr(1-Sin^2)

Where:
R = lenght of your moving arm
Sin = value given by accellerometer.

This is a much simpler way to handle this data with PBP.

Al.

Acetronics2
- 5th March 2009, 20:19
Hi,

Centrifugal acceleration equals (-) R x Omega^2 ...

measuring acceleration and angular speed and knowing lenghth of the arm ...

in Ze Pocket ...


Ok ... you must substract gravity ... Ok !

but just need angular position ...

correction is easy ... with a retrieve table ( LOOKUP ) that can reach up to 256 values ...


Did I miss anything ???

Alain