View Single Post
  #3   Spotlight this post!  
Unread 09-12-2013, 21:43
samn122 samn122 is offline
Registered User
FRC #0334
 
Join Date: Mar 2013
Location: Brooklyn
Posts: 4
samn122 has a spectacular aura aboutsamn122 has a spectacular aura about
Re: Gyroscope Not Returning Degrees

Quote:
Originally Posted by Joe Ross View Post
How is it connected?
The rate header is connected to the analog breakout on port 1. We followed this guide from AndyMark.

Quote:
Originally Posted by Joe Ross View Post
Why don't you think it's drift? How fast is it decreasing? What does it do when you rotate the robot?
The values it returns are inconsistent and simply unusuable. We are getting decimal values and after turning the robot a couple of times there would be no significant change. Sometimes it would jump and start increasing in the positive direction and go on indefinitely until the program is stopped. We don't think it's drift (or maybe it might be?) because we don't observe the values decreasing or increasing by a small margin. I will post a screenshot of the values on my next reply.

Quote:
Originally Posted by Joe Ross View Post
Please post the code you've tried.
The code we're trying is from Team 2945, found on the fourms. We modified it a little.

Code:
 package com.github.manitourobotics.gyroscopetesting;


import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.Gyro;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;


public class GyroscopeTesting extends IterativeRobot {

    public void robotInit() 
    {

    }

    AnalogChannel gyroChannel = new AnalogChannel(1);
    
    Gyro gyro = new Gyro(gyroChannel);
       
    public void teleopInit() 
    {
        gyro.reset();
    }

    public void teleopPeriodic() 
    {
        gyro.setSensitivity(0.007);
        double gyroAngle = gyro.getAngle();
        
        SmartDashboard.putNumber("Gyro angle", gyroAngle);
        System.out.println("Gyro Angle: " + gyroAngle);
        Scheduler.getInstance().run();
    }
}

Last edited by samn122 : 09-12-2013 at 21:50.
Reply With Quote