Member Since: December 31, 2012
Country: United States
Another possibility is to use jerk instead of acceleration. When the bag is punched, the momentum imparted by the fist generates an acceleration. Assuming that the rate of change of acceleration (jerk) is greater from a fist impact than from all the other sources of acceleration changes, it’s a simple matter to take the instantaneous derivative of the acceleration magnitude to get jerk and then apply a threshold. Anything greater than the threshold is a hit.
Using this approach with a very quick and dirty threshold calculation, the 77 hit data set comes up with 82 hits.
To calculate the instantaneous derivative, no calculus is needed. Simply remember that the derivative of a function is the limit of delta x / delta y as delta y goes to 0. Since our data is coming in at a more or less regular interval, we can approximate this by subtracting the current magnitude of the acceleration vector from the previous value and dividing the result by the time difference between the 2.
You’ll end up with positive and negative values. One is the result of fist impacts, the other of the bag hitting its stops and bouncing back. I made the assumption that the fist impacts are going to be harder, so I took the side with the largest jerk, which in this case was the positive side.
Again, I eyeballed the threshold from a plot, but you could do something more sophisticated like a statistical analysis of the jerk values and set the threshold at a certain number of standard deviations. Enjoy
OK, so that was gravitational acceleration. I had made it out to be about 500 just from visually examining my plot of the magnitudes. Of course, since I was looking at magnitudes and x & y never go to 0 (probably due to noise and thermal effects, as well as the bag not being level) 500 is a perfectly reasonable value when the vector math is done to find the magnitude of the acceleration vector.
BTW, Nate, you could have also used a microphone near the bag, done an FFT of the incoming audio and looked for the components that indicated a hit. That way you wouldn’t have to have modified the bag.
Here’s what my hit plot for the 77 hit data set looks like using the acceleration magnitude algorithm above (not the jerk). It’s binary, in that there’s either a hit or there isn’t. This plot does not show the strength of each hit. That’s the timestamp on the x axis, so plot out Nate’s data and see how it compares. He got a nice rhythm going between 7500 and 9000.
Instead of entering the contest I’ll give the rest of you a head start. Think of it as the ultimate shareware gift.
When I do this with the 77 hit data set, I see 80 hits which is a 4% error, substantially better than the 28% error Nate got.
Of course that 100 and 9 look like they came straight from the orificial oracle, but I actually got them from plotting the data with Excel and visually examining the plot. The fun part for you contestants is to figure out a self-calibrating scheme to set those thresholds automatically. By looking at the total magnitudes, you can also see how hard the hit was.
Good luck to all
And to debug it, add -g to both lines, then invoke the debugger on it with “gdb h-bridge_example”.
For that matter, do yourself a favor and shorten the names of the files :-)
Not bad, but a week late
It just looks like a lamp. What it actually is had to be trimmed from the image for decency’s sake.
Sounds just like the caption contest.
The chip may be 64 bits, but the OS is 32. That’s disappointing. First thing to do is to put together a 64-bit distro for it.
I think you guys got the price wrong. It seems to be 14950000000000 times too high (before taxes and shipping).
No public wish lists :(