Our inertial sensor will randomly swap directions. Normally turning clockwise increases the value and turning counterclockwise decreases the value. However, sometimes, with no apparent cause, this will swap and turning clockwise will decrease the value while counterclockwise will increase the value. As you can probably imagine this causes a variety of issues within our autons and programming skills. Is the sensor faulty or is there something we can change in the code?
How did you mount your sensor? Which side points up?
From what I understand when IMU starts up it detects which way is up and then computes quaternions with angles in all directions.
Could it be that you are tilting it causing it to think its up orientation changed?
I haven’t played with it yet but shouldn’t it increase CCW and decrease CW, right hand rule?
It’s mounted on the bottom of a 1x5 C-channel upside down. The C-channel is mounted via 4 rubber cortex mounts. It’s possible that mounting it upright could fix this issue, I’ll try that.
Can you post the code? I might know how to fix the problem. If you are you using the
.heading(degrees) method try
.rotation(degrees) instead. This is because
.heading(degrees) returns a value from 0 to 360, while
.rotation(degrees) can go above 360 and below 0. Also make sure you are on VexOS 1.0.9
Is it known if there is IMU filtering with sensor outputs? Obviously advanced dynamic systems and statistical predictions such as the Kalman filter wouldn’t exist, but is there quaternion complimentary tilt correction or any complimentary corrective filters for noise and bias?
We would rather not post the code since it’s really advanced and unique. We are using heading, but we actually created our own code that makes the heading work as rotation. Unfortunately the issue isn’t related to the counts resetting at those values, but is that the direction of the value is swapped.
These quotes give some insights on the way Inertial Sensor processes measurements:
Also, IMU diagnostics example: V5 internal sensor Code
It is hard to say what is going on without more detailed debugging information. I would start by opening IMU dashboard and observing all available numbers as you manually rotate the robot.