How to remove gravitational acceleration in MinIMU-9 v2?

I am using MinIMU-9 v2 and its open source code github.com/pololu/minimu-9-ahrs-arduino.. i want 2 things
1.i want acceleration in terms of ‘g’ units
2. i want to remove the gravitational acceleration…
how to do that in the above code?

It is easy enough to figure out the calibration constant for g – the accelerometer will indicate “g” along any vertical axis when held still.

It is almost never useful to remove the gravitational acceleration from the total acceleration measured by consumer grade IMUs. The device and calculation errors are simply too high. Read more about the problems here: chrobotics.com/library/accel … n-velocity

thank you for the reply… i got answer for 2nd question but i didn’t got the answer for 1st may be i have not asked the question properly… in their open source code github.com/pololu/minimu-9-ahrs-arduino. in the “Output” section they will print all the values no

Serial.print(",AN:");
  Serial.print(AN[3]);
  Serial.print (",");
  Serial.print(AN[4]);
  Serial.print (",");
  Serial.print(AN[5]);
  Serial.println();
  Serial.print(",");
#endif

here i want the accelerometer values in ‘g’ units. how to get that?

  1. Measure “g in internal units” by noting the value printed when X, Y or Z is vertical.

  2. Divide X, Y and Z values by “g in internal units”.

This procedure is called calibration, so you can google “accelerometer calibration” for detailed explanations. The calibration is usually different for each axis. In addition there may be an offset for each axis that should be subtracted before the division.