Accelerometer dimu sensor


#1

I’m using the accelerometer of the dIMU Sensor and i have some problems on the reading when i use this code:
#pragma config(Sensor, S2, DIMU, sensorI2CCustomFastSkipStates)
#include “drivers/dexterind-imu.h”

float x,y,z;
task main()
{
if (!DIMUconfigAccel(DIMU, DIMU_ACC_RANGE_2G))
PlaySound(soundException);
while(1){
DIMUreadAccelAxes10Bit(DIMU, x, y, z);
wait10Msec(1);
}
}
When I set up the program with the robot placed paralel to the floor the value of the y is 0, but if i set up the program with the robot placed perpendicular to the floor when i put the robot paralel to the floor the value of y isn’t 0, is 0,5, and i want that the accelerometer give me the same values when is in the same site no matter in wich position i set up the program, anyone can help? i will be very gateful.


#2

Hey Zas, did you find a way around this? Since you just posted on another subject, I assume you did.

The accelerometer can be calibrated. Looks like you’re using RobotC, so do you see the example program for calibrating?


#3

Hey Zas, did you find a way around this? Since you just posted on another subject, I assume you did.

The accelerometer can be calibrated. Looks like you’re using RobotC, so do you see the example program for calibrating?


#4

I didn’t find a solution, i just put the sensor on the floor and I execute this line when is on the floor:
if (!DIMUconfigAccel(DIMU, DIMU_ACC_RANGE_2G))
PlaySound(soundException);
Then i put the sensor in the robot and i start the program. This works but i dont like to put the sensor on the floor every time i want to start the program. Can you give me the link of the example program for calibrating? Thank you for answering.


#5

It looks like you’re using the Botbench examples for the sensor. Is that correct?

There are three examples:

dexterind-imu-test1.c
dexterind-imu-test2.c
dexterind-imu-test3.c

Example 2 (dexterind-imu-test2.c) initializes the sensor.

The attached “Calibrate” file should show you how to calibrate the sensor using RobotC.