![]() |
Gyro Issues
We are a rookie team that is trying to setup our drive system to drive straight by utilizing a gyro. We are having an issue with our gyro (ADXRS450) that came in the KoP. When we call getAngle() while our robot is stationary the angle constantly increases. We have tried gyro.reset() when the robot is initialized and the accumulators do reset to zero. However, they start to climb instantly (without touching the robot). Is this something that is supposed to happen or could we have something incorrectly set?
Below is our code: Code:
package org.usfirst.frc.team6484.robot; |
Re: Gyro Issues
At what rate does it increase? Some drift is expected.
|
Re: Gyro Issues
Here are some possibly useful links I found with a quick search: https://www.chiefdelphi.com/forums/s....php?p=1342950 https://www.chiefdelphi.com/forums/s....php?p=1340809 https://www.chiefdelphi.com/forums/s....php?p=1288186 https://www.chiefdelphi.com/forums/s....php?p=1286318 https://www.chiefdelphi.com/forums/s....php?p=1286324 https://www.chiefdelphi.com/forums/s....php?p=1399059 |
Re: Gyro Issues
Does turning the robot have any effect the on the angle from the gyro?
Is the drift rate high? It won't be zero, but it should be well below 1 degree per minute. We haven't used this particular gyro before, but could there be an issue with the SPI port? You can re-calibrating, not just resetting. Be sure to not move the robot during the re-calibration period. That's a sure way to get high drift. |
Re: Gyro Issues
I suggest that you measure the output voltage of the gyro. We had several of the previous generation of gyro give "at rest" voltages that were nowhere near the expected value of 2.5V. (As I recall, it was much closer to 5.0V). If the output is not exactly 2.5V, but reasonably close, you should be able to make adjustments in software.
|
Re: Gyro Issues
Quote:
|
Re: Gyro Issues
It looks like our drift issue was caused by calling reset() inside TeleopInit(). We initially got about 2 degrees of drift in one minute. Once we removed the reset() we only saw a small drift.
We then tested our gyro by manually turning the bot 90, 180, 270, 360, etc. and we received the correct values. However, now we feel our calculations are not correct since we are still turning instead of driving straight. If you look at our code above. We have only changed it by commenting out the reset() within the TeleopInit. We are only checking our Y value of our controller and setting our target direction to zero degrees. Any incite would be much appreciated. |
Re: Gyro Issues
Try the following code changes:
To robotInit(): Code:
@OverrideCode:
public void teleopPeriodic() {Sometimes just seeing the values being produced can lead to some insight. Hope that helps, Paul |
Re: Gyro Issues
Using Paul's suggestion, we monitored the kP value. We then did some tweaking and came up with a value of 0.007.
We now have a straight-driving robot! Thank you all for your help! Shawn |
| All times are GMT -5. The time now is 09:55. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi