Hi, we recently received a gyroscope and think its an amazing sensor
We are using RobotC 3.51 with all the drivers updated etc.
However, we have been having a few problems with it, quite often the values will keep going up (even if its not plugged in), this usually happens after a program download. The only way we have found to fix it is to re-download the RobotC firmware - is this a common issue, or is it just us? If its common, has anyone found a permanent fix? We just dont want to be using a sensor which can be unreliable in competition if its just us, we may have to get another one instead - because we think its awesome!
Support for the gyro has gradually been improving since it’s introduction, recent versions of ROBOTC are handling drift much better but the gyro is not perfect. Some things to watch out for.
The gyro must be stationary when it initializes, when the code first runs ROBOTC integrates and measures the offset voltage coming from it and uses this as a reference for no angular motion. I usually include the ability to reinitialize the gyro from some type of user input in my code. One technique is as follows.
// Cause the gyro to reinitialize
SensorType[theGyro.port] = sensorNone;
// Wait 1/2 sec
// Gyro should be motionless here
SensorType[theGyro.port] = sensorGyro;
// Wait 1/2 sec
Keep the gyro on as short a cable as is practical, don’t run the cable near potential sources of noise, ie. don’t run it with motor wiring, my normal setup would be to use a 6 inch cable and mount the gyro next to the cortex but it really depends on the configuration of your robot.
Although ROBOTC is handling drift a little better than last year I would include some code to remove drift when the gyro is stationary, there are some old discussions on the forum about this but the general idea is to ignore gyro changes below a certain threshold. Here is another excerp from some code that shows one technique.
Hmmm, that could be the issue actually… didnt think of that one, il give it a go today
Yup, i have it on a 6" cable screwed down to the chassis of the robot away from cables
Thats really interesting, il look into noise removal in my program
Hahahaha, of course it wouldnt be useful if it wasnt plugged in it was just an observation that when it plays up it acts as if nothing is plugged in - and then when the firmware re-downloads it works again
We arent using it for anything fancy, i have just written turning functions to use it instead of the encoders so it knows where it is from the start point. They are working great when the sensor is actually working