View Single Post
  #5   Spotlight this post!  
Unread 10-12-2013, 13:04
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 434
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Gyroscope Not Returning Degrees

I don't have the wpilib source avaialble, so I can't check to see if this should make any difference at all, but is there a reason you're setting the sensitivity repeatedly (in teleop periodic)?

The following is essentially what we've done every year with the gyro:
Code:
import edu.wpi.first.wpilibj.Gyro;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

public class GyroscopeTesting extends IterativeRobot {

    Gyro gyro;

    public void robotInit()  {
        gyro = new Gyro(1);
        gyro.setSensitivity(0.0070);
        gyro.reset();
    }

    public void teleopInit() {

    }

    public void teleopPeriodic() {
        double gyroAngle = gyro.getAngle();

        SmartDashboard.putNumber("Gyro angle", gyroAngle);
        System.out.println("Gyro Angle: " + gyroAngle);
    }
}
If that doesn't work then I'd start looking at wiring, or where I think Joe was heading with the voltage check on the rate pin, the sensor itself. The only time I've had a problem with the sensor though is when it was run over by the robot, which has happened more than once.
__________________
http://team2168.org
Reply With Quote