Idahowalker:
Which library are you using?
Im using the Sparkfun MPU9250 library
Show the IMU setup code; setting like gyro range, accelerometer range, filters, and so on and so forth.
void setup()
{
SerialPort.begin(115200);
Wire.begin();
// Call imu.begin() to verify communication with and
// initialize the MPU-9250 to it's default values.
// Most functions return an error code - INV_SUCCESS (0)
// indicates the IMU was present and successfully set up
if (imu.begin() != INV_SUCCESS)
{
while (1)
{
SerialPort.println("Unable to communicate with MPU-9250");
SerialPort.println("Check connections, and try again.");
SerialPort.println();
delay(5000);
}
}
// Use setSensors to turn on or off MPU-9250 sensors.
// Any of the following defines can be combined:
// INV_XYZ_GYRO, INV_XYZ_ACCEL, INV_XYZ_COMPASS,
// INV_X_GYRO, INV_Y_GYRO, or INV_Z_GYRO
// Enable all sensors:
imu.setSensors(INV_XYZ_GYRO | INV_XYZ_ACCEL | INV_XYZ_COMPASS);
// Use setGyroFSR() and setAccelFSR() to configure the
// gyroscope and accelerometer full scale ranges.
// Gyro options are +/- 250, 500, 1000, or 2000 dps
imu.setGyroFSR(2000); // Set gyro to 2000 dps
// Accel options are +/- 2, 4, 8, or 16 g
imu.setAccelFSR(2); // Set accel to +/-2g
// Note: the MPU-9250's magnetometer FSR is set at
// +/- 4912 uT (micro-tesla's)
// Can be any of the following: 188, 98, 42, 20, 10, 5
// (values are in Hz).
imu.setLPF(5); // Set LPF corner frequency to 5Hz
// setSampleRate. Acceptable values range from 4Hz to 1kHz
imu.setSampleRate(200); // Set sample rate to 500Hz
// This value can range between: 1-100Hz
imu.setCompassSampleRate(100); // Set mag rate to 100Hz
delay(2000);
gyrocalibrate();
}
What kind of gyro thingy do you get when you remove the offsets? Where did you get an offset values?
The offset values are from my calibration shown here
void gyrocalibrate(){
Serial.println("Gyro will now be forced into obedience, please keep the sensor still and wait 5 secounds");
delay(5000);
while (i<=2000){
if ( imu.dataReady() )
{
imu.update(UPDATE_ACCEL | UPDATE_GYRO | UPDATE_COMPASS);
a_x = imu.ax;
a_y = imu.ay;
a_z = imu.az;
g_x = imu.calcGyro(imu.gx)-g_offset_x;
g_y = imu.calcGyro(imu.gy)-g_offset_y;
g_z = imu.calcGyro(imu.gz)-g_offset_z;
}
g_store_x = g_store_x + g_x;
g_store_y = g_store_y + g_y;
g_store_z = g_store_z + g_z;
a_store_pitch = a_store_pitch +a_pitch;
a_store_roll = a_store_roll +a_roll;
if (i==500){
g_offset_x = g_offset_x+ g_store_x/i;
g_store_x = 0;
g_offset_y = g_offset_y+ g_store_y/i;
g_store_y = 0;
g_offset_z = g_offset_z+ g_store_z/i;
g_store_z = 0;
}
if (i==1000){
g_offset_x = g_offset_x+ g_store_x/i;
g_store_x = 0;
g_offset_y = g_offset_y+ g_store_y/i;
g_store_y = 0;
g_offset_z = g_offset_z+ g_store_z/i;
g_store_z = 0;
}
if (i==1500){
g_offset_x = g_offset_x+ g_store_x/i;
g_store_x = 0;
g_offset_y = g_offset_y+ g_store_y/i;
g_store_y = 0;
g_offset_z = g_offset_z+ g_store_z/i;
g_store_z = 0;
}
if (i==2000){
g_offset_x = g_offset_x+ g_store_x/i;
g_store_x = 0;
g_offset_y = g_offset_y+ g_store_y/i;
g_store_y = 0;
g_offset_z = g_offset_z+ g_store_z/i;
g_store_z = 0;
}
i+=1;
}
i=0;
}
Without this offset, the gyro values are not set at 0d/s and continuously add errors to the integration. For now, no filtering has been applied, I will most likely add a moving average filter to accel values and a complimentary for sensor fusion.
I have not applied any offset to the accelerometers or any calibration because it seems to be giving generally good values that I can use to reference, for now, I will calibrate it later. I will so be using this accelerometer data shown as a_store_pitch to reference the gyro values one I can get a good amplitude from the gyro values.
Thank you again for continuing to reply, my ignorance is getting really frustrating and im just trying to get usable data so I can work on more entertaining things haha like actual controls.