|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Gyros and WPILib
Our team is using WPILib to program our robot, and we are trying to use a gyroscope to get the heading of the robot. We are using an ADXRS150 gyroscope, and when we try to read off of it, we get continuously incrementing values. Our gyro test code looks somewhat like this:
At the beginning of the autonomous method (only gets called once): Code:
SetGyroType(GYRO_PORT, ADXRS150); InitGyro(GYRO_PORT); //The following should create a delay so we don't start doing anything else right after initializing StartTimer(5); while(GetTimer(5)<2000); StopTimer(5); StartGyro(GYRO_PORT); Code:
printf("GyroHeading=%d\r", GetGyroAngle(GYRO_PORT));
Again, whenever we run the test code, the gyro angle continuously increments, regardless of whether or not we turn the gyro. The analog value being returned is varying from about 536-544, staying mostly within +/-2 of the center value. EDIT: We fixed output from a long to an int, so the values we are getting are reasonable. However, every second or so, it's still incrementing. EDIT 2: It now changes as we turn it, but the output is not in tenths of a degree (as WPILib specifies), or even in degrees. It is about 1/4 as much as it should be...any ideas what's wrong? Any ideas as to what's wrong, and what we can do to fix it? Thank you for your help. Last edited by RyanW : 26-01-2008 at 11:46. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WPILib and Eclipse | Guy Davidson | Programming | 31 | 02-04-2008 16:59 |
| WPILib and FRC default code | CRBreingan | Programming | 3 | 25-01-2008 20:46 |
| WPILib and FRC default code | CRBreingan | Programming | 7 | 23-01-2008 21:11 |
| Direct Control of PWMs and OI in WPILib | CyberWolf_22 | Programming | 7 | 06-02-2006 19:06 |
| White Paper Discuss: Use of Gyros in Navigation, Tip Prevention, and Driver Control | CD47-Bot | Extra Discussion | 1 | 18-03-2004 08:36 |