Go to Post Monkeys with typewriters will eventually create shakespeare, and spam bots will eventually create a thread title that fits the rumor mill. - rtfgnow [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 01-16-2016, 08:17 PM
crazycats crazycats is offline
Registered User
FRC #0386
 
Join Date: Jan 2016
Location: Florida
Posts: 2
crazycats is an unknown quantity at this point
Question How to use a gyro?

Newbie software mentor here.
Our team is using Java for the first time and we'd like to use a gyro. We've read through the control system and roboRIO documentation and can't seem to find anything that describes (1) what to do with the hardware and (2) what to do with the software.

The roboRIO has an accelerometer however the documentation was baffling.

Snippets of documentation we found were:
"Gyros typically in the FIRST kit of parts are provided by Analog Devices, and are actually angular rate sensors. "
and
"Note: The AnalogGyro class in WPILib uses a hardware (implemented in the FPGA) accumulator to perform the integration. This means Gyros are supported on a specific, limited, set of channels. On the roboRIO this is currently Analog Inputs 0 and 1 on the on-board headers."

So does this mean we can install a gyro made by Analog Devices in Analog inputs 0 and 1 and the sample code could be used to determine the angle? If so, what are the supported devices we can install? We do have gyros from previous years.

Also, when the Note above refers to "the FPGA", what FPGA are they talking about?

Many thanks.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-16-2016, 08:30 PM
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: How to use a gyro?

The "FPGA" refers to the hardware on the roboRIO thats running the linux archetecture that we deploy code upon. When it says "The FPGA", I assume its referring to the integration of the gyro... The gyro is a rate sensor, not a position sensor, so the integration is done on the FPGA (circuit-side) to get cycle times of >60hz (oh yes I am correct on this assumption as i actually read your post)

That tutorial on ScreenSteps should work fine, just follow it as it says.

Also, you don't need to connect both ports if you're looking to do something like turning 45 deg. On the KoP gyro, the port you want is closest to the edge and signal is facing inward

After that, just initialize it as it says in the screensteps

Code:
 myGyro = new AnalogGyro(port)
and to get the delta angle (angle since last reset),

Code:
myGyro.getAngle()
If you want to reset it, just call

Code:
myGyro.reset()
and getAngle() will return 0. If you turn 15 deg, getAngle will return 15deg. If you turn 30, it will return 30deg. etc.
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
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 08:00 AM.

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