Quote:
Originally Posted by Joe Ross
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
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
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();
}
}