owltheory
31-01-2014, 23:27
Greetings all,
With two weeks left, I hope everyone's robots are coming along well.
We're in the process of getting our sensors to work in Java, but we seem to have hit a wall when it comes to the gyro. As the title suggests, when we call the getAngle() method, all we consistently get is 0.0. We've tripled checked wiring based on this document, and we've tried multiple analog breakouts and multiple gyro sensors. We know the analog breakout works because we've gotten a rangefinder sensor to work off of the same unit. Based on this, I've concluded it has something to do with the programming. We are using java, the 2014 library (haven't checked for an update yet, but I don't think that would be the issue), and the cRio is running the 2014 image.
We're out of ideas and hoping you can help.
I attached the relevant snippets of code, but I can attach the whole class if necessary. We're planning to use the gyro for direction-sensitive mecanum drive.
Gyro gyro;
public void robotInit()
{
...
gyro = new Gyro(1); // We've checked the port number
...
}
public void teleopInit()
{
gyro.reset();
}
public void teleopPeriodic()
{
System.out.println(gyro.getAngle());
}
Which yields a continuous stream of "0.0\n", regardless of how the gyro is moved.
We appreciate any help you can offer, and let me know if you need more information.
With two weeks left, I hope everyone's robots are coming along well.
We're in the process of getting our sensors to work in Java, but we seem to have hit a wall when it comes to the gyro. As the title suggests, when we call the getAngle() method, all we consistently get is 0.0. We've tripled checked wiring based on this document, and we've tried multiple analog breakouts and multiple gyro sensors. We know the analog breakout works because we've gotten a rangefinder sensor to work off of the same unit. Based on this, I've concluded it has something to do with the programming. We are using java, the 2014 library (haven't checked for an update yet, but I don't think that would be the issue), and the cRio is running the 2014 image.
We're out of ideas and hoping you can help.
I attached the relevant snippets of code, but I can attach the whole class if necessary. We're planning to use the gyro for direction-sensitive mecanum drive.
Gyro gyro;
public void robotInit()
{
...
gyro = new Gyro(1); // We've checked the port number
...
}
public void teleopInit()
{
gyro.reset();
}
public void teleopPeriodic()
{
System.out.println(gyro.getAngle());
}
Which yields a continuous stream of "0.0\n", regardless of how the gyro is moved.
We appreciate any help you can offer, and let me know if you need more information.