Inertial Sensor Being Inconsistent

Hello,

I’ve gotten my inertial sensor to work but every time the robot rotates it gets off by about 5 ±5 degrees, which is a lot. Is there any way to fix this or improve consistency in this sensor? Thanks

Idrk know anything a lot programming so correct me If I’m wrong, but this is probably because if your robots wheels immediatley stop with no Pid the robot will overshoot whatever degree turn you tried to make because robots usually can’t instantly stop.

1 Like

do the sensor values vary, or the rotation of the robot? if its the robot that’s varying, you could definitely improve it. try slowing down as you approach your target, or using a pid loop to accurately meet your desired rotations.

Can you show your code?

Tonight I saw a demo of a robot that was able to do field relative driving and it was pretty cool. It was dealing with 1 degree changes and was very smooth across the field. At least for this robot, the sensor is working as advertised. (Plug time: It’s programmed with the Robotmesh blocks)

1 Like

It’s not a matter of PID the sensor has just been inaccurately measuring the orientation of the robot and it is mounted on rubber links so I’m confused as to why it’s doing this. I’ll send code in a minute.

First I have the code calibrate the sensor.
inertialGyro.calibrate();
while(inertialGyro.isCalibrating()){
wait(10, msec);
}
Then I reset the values
inertialGyro.resetHeading();//which one do I use?
inertialGyro.resetRotation();
Then in my code I use this to print the angle of the robot to the brain screen.
robotAngle=inertialGyro.rotation(rotationUnits::deg);
The problem is that while testing moving the robot in driver and rotating it in circles and such this sensor has gotten about 5 degrees ± 5 degrees per rotation. This is way too inaccurate to use for a programming skills run.

Try re-calibrating the motor either with code or the devices screen on the brain.

so just to confirm, the gyroscope is returning values up to 5 degrees off from what it should?

Yah or even up to 10 degrees it’s inconsistent

hmm that is strange. how quickly does it become inaccurate? is it a sudden thing or does it gradually drift?

It drifts to like .23 or around there everytime I start the program but then doesn’t really drift after that. It seems to just be measuring the angle of the robot wrong for some reason which is weird.

1 Like

Are you giving the sensor time to calibrate?

Which should make no difference as all the calculations for heading are done inside the sensor and vexos.

3 Likes

Yes @jpearman do you have insight into what the problem could be?

too many variables to really say. drift would generally be in one direction, but you said +/- 5 degrees. The IMU mounting position may have an impact as well as vibration, perhaps post some pictures and the code so we have more information.

6 Likes

I posted my plug because I had feedback that to use sensors teams needed to use Vexcode. The Robotmesh software works fine, our roboteers are also using the blocks part with good success.

Use rotation. Heading is a 0 to 360 degree value, while rotation can go past 360 and into the negatives.

I use rotation on purpose this shouldn’t affect anything though.