Go to Post it's flattering, but a little scary, because I don't know if I'm ready to be an inspiration! - MissInformation [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-02-2012, 21:19
2869Robotics 2869Robotics is offline
Registered User
FRC #2869
 
Join Date: Jan 2012
Location: Bethpage
Posts: 18
2869Robotics is an unknown quantity at this point
Gyro Code

Could someone give me some sample code for using the gyro? I'm not sure how to program for it.
Reply With Quote
  #2   Spotlight this post!  
Unread 09-02-2012, 22:04
Derek012's Avatar
Derek012 Derek012 is offline
I miss my frisbees
FRC #4564 (Orange Chaos)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Maine
Posts: 25
Derek012 is on a distinguished road
Re: Gyro Code

The wpilibj offers a class on their API http://www.wbrobotics.com/javadoc/ed...libj/Gyro.html
but you would need to create the Gyro object then specify which analog port on the cRio you are using,
Gyro gyr = new Gyro(aPort);
...
Then in the method your choosing for your implementation you would call the angle using, gyr.getAngle();
This method isn't exactly what it seems though because a gyro calculates its angles by rate you may need to set your sensitivity different depending on your gyroscope using gyr.setSensitivity(int volt/degree/sec);
Also for those times were you need to reset to zero there is a reset() that you can use.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi