integrate to get displacement from acceleration over time
Hello all,
I have a 2-axis accelerometer circuit that will be sending values to max/msp, and I'd like to be able to determine location information over time. The last time I used calculus was about 15 years ago, so I'm a little rusty here, but I think I'd need to integrate to get velocity and then displacement.
Is this something that's possible in Max? Any pointers would be greatly appreciated!!
Spencer
I tried this before, but didn't get accurate results and stopped.
The idea in integration is to sum the difference between consecutive
values of your data stream multiplied by the duration of the interval
between these values (like computing a surface):
-> sum [ (value[timeX]-value[timeX-1])*(timeX-(timeX-1)) ]
should give you the speed. And if you apply the same process on speed,
you'll get the position.
You probably won't get your data on a regular time interval, so
timeX-(timeX-1) will vary over time.
The problem is that the datas, and especially the time intervals, are
not extremely accurate, so after a while, your speed won't be 0
although the accelerometer doesn't move anymore because the sum of
acceleration and deceleration won't _perfectly_ match. And so the
positions will move too.
As an accelaration of 0 doesn't mean that there is no movement (I was
surprised to notice that the violin player I worked with moved her bow
with a perfectly stable speed, i.e. no acceleration!), it is not easy
to add some "reset" function to the speed and position; it depends on
the physical properties of your moving object (in the case of a bow,
you know the range of the movement, and could eventually manually reset
the position when an extremity of the bow is reached).
Another issue is that your accelerometer will probably return 0->1 G
values if it's only rotated, without changing its position within the
world.
Good luck.
_____________________________
Patrick Delges
Centre de Recherches et de Formation Musicales de Wallonie asbl
http://users.skynet.be/crfmw/max
On 24 avr. 06, at 13:00, Patrick Delges wrote:
Ooooppppsssss, I'm afraid I wasn't very concentrate when I posted this
message and made a strange mix between integration and derivation...
You don't want to sum the differences between values, but the values
themselves, times the delta-time. I found a small test patch I made
that may give you some ideas... but there is still a lot to do!
_____________________________
Patrick Delges
Centre de Recherches et de Formation Musicales de Wallonie asbl
http://users.skynet.be/crfmw/max
Thanks for your reply! I will be testing this week, and I'll let you know how it works out.
Best,
Spencer
FYI...going from acceleration to position is going to be tricky as
you're going to have a second order integrator. Errors will
accumulate very fast without some sort of error correction term in
your calculations.
best,
wes
spencer kiser wrote:
> I have a 2-axis accelerometer circuit that will be sending values to
> max/msp, and I'd like to be able to determine location information
> over time. The last time I used calculus was about 15 years ago, so
> I'm a little rusty here, but I think I'd need to integrate to get
> velocity and then displacement.
Mathematically its not a problem as Patrick showed, but as your
accelerometers are analog you will get errors which add up fast. You
won't be able to track absolute positions with that very precisely,
unless you combine it with a way to correct it, for example with a
camera, or with single events which could only occur at a defined point.
All depends on what you want to do with it.
Stefan
--
[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]
Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation
/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///
-------------------------x----
--_____-----------|-----------
--(_|_ ----|-----|-----()----
-- _|_)----|-----()-----------
----------()------------x-----
14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09