|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Need help with gyros
I'm getting some strange results when trying to read my gyroscope. As it sits there the gyro seems to accumulate angle: it will slowly count upwards, starting at zero and gradually drifting upwards into positive values. For the life of me I can't figure out why, with the robot sitting dead still, the gyro reading does not stay at zero. Anyone else have this problem?
Gyro test loop: Code:
// gyro test
while (this.isDisabled()) {
station.toLCDLine(3, "Gyro Test");
double sensitivity = 0.000;
//spinGyro.setSensitivity(sensitivity);
String msg = "Sensitivity " + sensitivity;
station.toLCDLine(4, msg);
msg = "Heading " + getCurrentHeading();
station.toLCDLine(5, msg)
Code:
public double getCurrentHeading() {
double current = spinGyro.getAngle()%360;
if (current > 180) {
current = -(current - 360);
}
return current;
}
|
|
#2
|
||||
|
||||
|
Re: Need help with gyros
Quote:
|
|
#3
|
|||
|
|||
|
Re: Need help with gyros
Then I guess my next question is how do I fix it? Issuing a gyro.reset() command to return it to true constantly defeats the purpose of having a gyro to begin with.
|
|
#4
|
|||
|
|||
|
Re: Need help with gyros
It depends what you are trying to do, if you just need it for maneuvers that take short periods of time resetting is usually good enough. It's also possible to take advantage of the temperature pins to increase the accuracy/reduce the drift. I've never actually done it, it won't eliminate the the problem, but it should reduce the drift.
|
|
#5
|
|||
|
|||
|
Re: Need help with gyros
Autodrive routine. I want it to go forward while keeping true. Positive drift of the gyro will generally cause the bot to slowly curve to the right. I was also playing with the idea of a one button "auto true", which would realign the bot to the scoring wall automatically.
I suppose I could use a floor function and round things off. Just bothers me that someone would build a gyro that doesn't hold true. I suppose I could build my own and measure the torque created when I turn it, but that kind of project is more for between competitions. |
|
#6
|
||||
|
||||
|
Re: Need help with gyros
Quote:
|
|
#7
|
|||
|
|||
|
Re: Need help with gyros
Not terribly fast in the grand scheme of things, but all those tiny errors accumulate over time until you aren't pointed right. Mostly I'm thinking in terms of auto-aiming the bot towards one end or another, and I can't do that if the bot is 45 degrees off but the gyro reads 63.
|
|
#8
|
||||
|
||||
|
Re: Need help with gyros
Quote:
I'm told that the gyro error at the end of 2 minutes is only about 1.5 degrees. |
|
#9
|
||||||
|
||||||
|
Re: Need help with gyros
Quote:
|
|
#10
|
||||
|
||||
|
Re: Need help with gyros
Quote:
|
|
#11
|
|||
|
|||
|
Re: Need help with gyros
I was exaggerating
I'll put a timer on it tonight and figure out the exact drift. Actually, I'll do it a few times, see if the drift is constant. If it is it'll be easy to correct depending on how long it's been since the last reset. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|