I am trying to run the IMU orientation visualiser, and I am defining ax, ay, az, gx, gy and gz to be floating-point numbers because I need higher accuracies, however I got this error:
error: no matching function for call to 'CurieIMUClass::readMotionSensor(float&, float&, float&, float&, float&, float&)'
CurieIMU.readMotionSensor(ax, ay, az, gx, gy, gz);
Does anyone know of a way to do this without causing an error?
The IMU outputs signed 16 bit numbers. These are LSBs of the fullscale value the IMU is set up to expect.
To put it another way, the maximum and minimum outputs you can get are +32767 and -32768.
So if your IMU is set to the +-2G range, a value of 16383 is +1G.
(16383/32767) * 2G = 1G
An output of -4096 in the +-2G range:
(-4096/32767) * 2G = -0.25G
Or if your IMU is set to the +-4G range, a value of 16383 is +2G.
(16383/32767) * 4G = 2G
etc
Defining them as floats will not make things more accurate. +-2G is the most sensitive measurement range, and it is set to this range by default as far as I know. If you could calculate and output more measurements per second then that would improve the motion tracking - but the biggest bottleneck here is the Madgwick math, which I assume is unlikely to be improved on.
(My advice is based on playing with a slightly different implementation of the Madgwick filter, and using it with a different processing sketch)