Measure linear acceleration of a moving object in space using an IMU - Page 1
Forum section: electronics / beginners

author: M_Holden
author_rank: Newbie
timestamp: December 10, 2016, 04:47:20 pm
content: Hi,I would like to measure the linear acceleration ( parallel to the floor ) of a moving object ( human fist ).i don't have a lot of experience with IMUs and sensor fusion and would like to know the best way or if it is even possible to implement such a system.I was thinking of using an accelerometer and gyroscope to calculate the angular position of the fist in space ( like a quadcopter) and then in theory once i have this angular information and the accelerometer data i should be able to calculate the acceleration along the horizontal axis, no?Thanks for the help.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 10, 2016, 06:13:27 pm
content: Often a mix of sensors gives the best information. Since a human fist is connected through the body to the floor there are constraints on where the fist can be. You can imagine how you could add IMUs, or accelerometers, or even angle sensors and various joints and along with a physical description of the body estimate the motion you are interested in.If sensors were perfect this would be a trivial exercise, but the reality is that all sensors have gain, offset, linearity and other errors in addition to noise. For a start on how to put this all together do some searches on parameter estimation. The math will be fairly heavy, but I am not aware of any way to do this without some pretty deep math.

author: tatus1969
author_rank: Super Contributor
timestamp: December 10, 2016, 06:23:51 pm
content: Quote from: M_Holden on December 10, 2016, 04:47:20 pmA 2-axis accelerometer would be enough for that, you don't need sensor fusion and all the math behind that in this case. I did that once, blew my mind at times. Different coordinate systems, gimbal lock problem, etc etc.If you need the orientation as well, then you'd also need a 2-axis gyro, plus a magnetic compass (orientation from gyro will quickly accumulate error).

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 11, 2016, 02:39:42 am
content: Quote from: tatus1969 on December 10, 2016, 06:23:51 pmThat is true if you know that the two axes of the accelerometer were parallel to the floor. Which may or may not be true in the OPs problem. It is definitely not true in the general case of a boxers fist, or of the fist of a fully articulated robot arm.

author: salbayeng
author_rank: Frequent Contributor
timestamp: December 11, 2016, 05:50:43 am
content: Horizontal acceleration of anunconstrainedbody (human hand) is fairly difficult to measure. It's a piece of cake measuring horiz acceleration on a model railway wagon for example, it's just the bare signal from the accelerometer.Your number 1 problem is tilt. If the accelerometer base is tilted 6degrees, then the horizontal accelerometers will see 0.1g (=1m/s^2) , so if if you tilt your hand 6degrees for 10 seconds, your fist will apparently be travelling at 10m/sec and will have separated from your torso 8 seconds ago. Even tilted 0.6degrees is a major problem.You need an independent means of determining where "up" is , a compass only yields 2 angles (can't measure tilting to east/west). Gyros only give angle rate information not absolute angle. The Wii remote uses 2 IR sensors to determine Azimuth and Elevation angles of the user. It and smart phones use "gesture recognition" to look for certain shapes of waveform from the accelerometers.The 2nd smaller problem is centripetal acceleration effects , i.e when you are spinning on the spot, your hand describes a circle, and is continuously accelerating in towards you, A gyro only provides part of the answer, as the gyro reads the same rate when on your body and at your arm, so to accurately account for centripetal accelerations we need to know the tangential velocity at the accelerometers, but wait we haven't measured that yet!A real IMU runs navigation software, and can provide approximate solutions for current position/velocity/acceleration/angles if it starts from a known fixed point, but these will drift off if a "fix" isn't obtained regularly. Note that the earth is curved , so centripetal effects are different going east to going west and going north or south. and are completely different on the equator to the pole. A correctly calibrated IMU should register itself as rotating exactly 15.00000degrees per hour about the earths axis when stationary. So even a good gyro will tell you lies about how level your hand is, if you point your arm north, it will say your thumb is going down at 1 deg every 4 minutes, if you point your hand south the thumb goes up at the same rate.A hobby level IMU (as used in drones) will drift off after a minute or so (it needs GPS for fixes).

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 11, 2016, 04:14:03 pm
content: Quote from: salbayeng on December 11, 2016, 05:50:43 amThe human hand is partially constrained, but otherwise this identifies some of the problems you run into. Knowing that the hand is partially constrained helps identify some of those lies, but does lead you further into the math weeds. This problem is of wide interest currently in robotics. There are papers available, but much of the work is proprietary. Low cost silicon IMUs are being marketed specifically for this type of problem. They are very interesting devices, with prices that are orders of magnitude lower than traditional IMUs, and surprisingly good performance, though also orders of magnitude worse than some IMUs. Some checking of app notes on manufacturers web sites, and googling topics like "low cost imus" will get you a long ways toward where you are going.

author: M_Holden
author_rank: Newbie
timestamp: December 12, 2016, 01:36:27 pm
content: Thanks for the replies.I decided to build a small datalogger based on this IMUhttps://www.sparkfun.com/products/13944which comes with a library to do the difficult math calculations. I will log the quaternion and the accelerometer data. For my application i need the acceleration of the boxer fist and then the deceleration on impact. I will try to calculate the acceleration from the IMU data and then compare it to the one calculated with a mechanical device.I will let you know how it goes.Thanks again

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 12, 2016, 02:44:36 pm
content: Quote from: M_Holden on December 12, 2016, 01:36:27 pmYou may need to think through your question. Given the quantities you are interested in, why is the portion of the motion parallel to the floor the only item of interest? If you are designing a simulator to test protective gear, or any other activity that relates to the damage caused by a punch I would think the total vector would be of interest.

author: Brutte
author_rank: Frequent Contributor
timestamp: December 12, 2016, 02:50:49 pm
content: In a simplified planar case (on a plane) an acceleration that comes from inertia has 4 components. In a polar coordinate system:linear (d2r/dt2) or radialcentripetal ((dphi/dt)2/r)angular (r*d2phi/dt2)coriolis (2*dphi/dt*dr/dt)where r is the distance to center of rotation (~fist to arm in here) and phi is the angle of the fist arm line.And there is the fifth component, gravitational acceleration (its projection to that plane) which fortunately is about constant.The accelerometer measures the (geometric) sum of the five.From what I see you need to measure at least: dphi, d2phi, r, dr and d2r to get what you want.

author: rstofer
author_rank: Super Contributor
timestamp: December 12, 2016, 11:42:56 pm
content: I'm not planning to work on this particular problem but I did buy this IMU with built in motion calculations:https://www.sparkfun.com/products/11028I have no idea what to do with itbut last night my grandson and I were discussing gyros (the toy kind) and gimbal lock (the Apollo kind). While I have his interest, I'll build up a demonstration of gyros and accelerometers.Apollo spacecraft had three ways of establishing orientation: Gyros, celestial navigation and radar tracking from the ground. I would think that video is going to play into this problem sooner or later. A little bit of object tracking in 3 dimensions, relative to the environment, might help refine the solution. Getting the frame rate high enough might be a problem. There are some very fast cameras around.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 13, 2016, 02:22:03 am
content: Quote from: rstofer on December 12, 2016, 11:42:56 pmVideo and other methods for tying back to a "fixed" reference frame may not be important in this case. A punch normally takes only a fraction of a second, and even these lousy IMUs don't drift much in that time. All depends on how his system starts and resets after a punch.

author: salbayeng
author_rank: Frequent Contributor
timestamp: December 15, 2016, 05:21:45 am
content: An approach that is worth testing is set up an experimental method that forces strong constraints and boundary conditions on the test run.To do this you need some kind of physical datum, some kind of bar or a box that produces a fairly consistent positioning, at approximately the same height as the punch, but off to the side. The bar should ideally be horizontal or vertical (whatever is closest to the average fist position) and the IMU should be orientated in the glove so that an axis is nearly vertical in the datum position. (Redefine that as Z)So to do a test run(a) Rest glove on the bar for 5 seconds(b) Throw a punch in the next 5 second interval(c) Rest glove on the bar for 5 secondsBefore this you should have done an accelerometer scale and zero calibration.This approach will produce results in approximatelybody coordinates.Foraccelerationswe have U V W axis , so if you are facing north then U = motion to the north(X accelerometer), V = motion to the east(Y accelerometer), W=up and down (Zaccelerometer), I'll be lazy and just call these X Y Z .Forrotationswe have palm rotate up/down = pitch P, wrist rotate CW/CCW = Roll R , Turning on the spot = Yaw axis Y . (In world coordinates you can define Az El coordinates, by eg pointing at something with your finger, the compass direction you are pointing at is azimuth, the angle from finger to floor = elevation)Note you have to be careful about which directions are positive, or the matrix algebra will get messed up, I think North East Down is one example of a correct sign system??So once you have recorded a run(1) Scale the accelerometers with the known gains and offsets. This will give the three acceleration Ax, Ay, Az(2) Determine the initial and final tilt angles and G magnitude, from the accelerometer tilts at start and finishSo local gravity, Go= sqrt(Ax2+ Ay2+ Az2)Tilt about Roll axis, Ro= arcsine(Ay/Go) , about pitch axis, Po= arcsine(Ay/Go)The starting (and finish?) Yaw orientations should be set to zero(3) Determine the gyro rate offsets from the average of (start and finish), (or a measurement with the glove resting on a table within the last hour may suffice) . Now integrate the gyros to get angle , using the tilts in (2) as starting points if the integrated angle doesn't finish close to the final tilts, then make a small tweak to the offsets , something like correction = (calc_angle - final_tilt)/10sec.(4) Calculate the apparent accelerations in Axt, Ayt based on sine(tilt) , and Azt based on cos(xtilt)*cos(ytilt)(5) Calculate the centripetal accelerations based on Axc = Rz * Vy + Ry * Vz , That's basically a cross product, centripetal_Acceleration_in_X_direction = ( angular_Rate_around_Z_axis times velocity_ in_ydirection) + ( angular_Rate_around_y_axis times velocity_ in_zdirection).(6) Subtract (4) and (5) from the raw accelerations to give corrected accelerations. Getting the sign right is important.(7) Integrate these to get corrected velocities, these should all start and stop at zero, if not add a small offset tweak to the accelerations.(Integrate the velocities to get position ( these should all start and stop at zero, if not add a small offset tweak to the accelerations.)Ideally you should use the velocities in (7) to refine the centripetal correction step in (5)At this point you should have sufficiently accurate data for your measurements of acceleration and orientationThis method does not handle orientations correctly from a maths perspective, but if you keep all angles within +/-60 degrees of your reference position you should be close enough. You can see the errors by doing a test run where you tilt the glove 45 degrees up, and pirouette 360 degrees (your data will only show about 270 degrees of rotation. You will also get similar error if the fist makes a stirring motion.