|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
gyro.getAngle() only outputs 0.0
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. Quote:
We appreciate any help you can offer, and let me know if you need more information. |
|
#2
|
|||
|
|||
|
Re: gyro.getAngle() only outputs 0.0
It doesn't appear you've set the scale of the gyro. I believe you need to call the method gyro.setSensitivity(double voltsPerDegreePerSecond) in order to make things work.
Sensitivity is a constant that should be on your gyro spec sheet and it is measure in volts per degree per second. |
|
#3
|
||||
|
||||
|
Re: gyro.getAngle() only outputs 0.0
The sensitivity has a default setting and shouldn't need need to be specified by the user
The problem could be due to GetAngle() not being capitalized. I hope you figure it out soon. Good luck! |
|
#4
|
|||
|
|||
|
Re: gyro.getAngle() only outputs 0.0
Quote:
Quote:
I also looked over the example that I originally posted an realized that it stores the value in variable before printing it. I wouldn't think that this would make a difference either, but we're running out of options. Thanks for the help, I'll keep you updated. |
|
#5
|
||||
|
||||
|
Re: gyro.getAngle() only outputs 0.0
Quote:
UpperCamelCase is correct if you are using C++, which it sounds like you are not. |
|
#6
|
|||
|
|||
|
Re: gyro.getAngle() only outputs 0.0
Correct; GetGyro() does not work. But I figured it out.
Someone decided we needed to put a gyro.free() in there, and this was the reason it was happening. Took that out and the gyro began working immediately. Thanks for taking the time to reply. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|