Go to Post So why are we trying to go to Mars? It's because it's bigger, better, and bolder. Doing what nearly no other team can do, and defying all those who say it can't be done. That reward is a lot more than 9 points. - Mike [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 11-02-2012, 22:26
dellagd's Avatar
dellagd dellagd is offline
Look for me on the field!
AKA: Griffin D
FRC #2590 (Nemesis) #2607 (The Fighting Robovikings)
Team Role: Mentor
 
Join Date: Sep 2011
Rookie Year: 2011
Location: PA
Posts: 890
dellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond reputedellagd has a reputation beyond repute
Using a Gyro on any port (How to code that)?

The title pretty much says it. We are trying to use three Gyros on our bot this year, but we understand that there are only two available hardware accumulators on the robot. Since this is getting down to the wire, has anyone already written some JAVA for this to just take the analog signal from the gyro? We tried for a good deal of time today with no avail.
__________________
Check out some cool personal projects in computers, electronics, and RC vehicles on my blog!

2016 MAR DCMP Engineering Excellence Award
2016 MAR Westtown Innovation in Control Award
2016 MAR Hatboro-Horsham Industrial Design Award
2015 Upper Darby District Winners - Thanks 225 and 4460!
2015 Upper Darby District Industrial Design Award
2015 Hatboro-Horsham District Winners - Thanks 2590 and 5407!
2014 Virginia Regional Winners - Thanks so much 384 and 1610, I will never forget that experience!
2014 Virginia Quality Award
2014 MAR Bridgewater-Raritan Innovation in Control Award
2014 MAR Hatboro-Horsham Gracious Professionalism Award
2013 MAR Bridgewater-Raritan Innovation in Control Award
2012 MAR Lenape Quality Award
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2012, 23:17
sand500 sand500 is offline
Registered User
FRC #3540 (Wildcat Robotics)
 
Join Date: Jan 2011
Rookie Year: 2011
Location: United States
Posts: 81
sand500 is an unknown quantity at this point
Re: Using a Gyro on any port (How to code that)?

make sure your gyro is plugged into an Analog Breakout.
Then, just use the gyro class in java and it should work.
assuming you are using the gryo that comes attached to the accelerometer.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2012, 23:23
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 990
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Using a Gyro on any port (How to code that)?

Quote:
Originally Posted by sand500 View Post
Then, just use the gyro class in java and it should work.
assuming you are using the gryo that comes attached to the accelerometer.
That works great for the first two, but there are only two accumulators in the FPGA so you can only use two instances of the built in gyro class
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2012, 03:41
ItzWarty ItzWarty is offline
Registered User
FRC #1072 (Harker Robotics)
Team Role: Leadership
 
Join Date: Jan 2012
Rookie Year: 2010
Location: California
Posts: 15
ItzWarty is an unknown quantity at this point
Re: Using a Gyro on any port (How to code that)?

The throw new Exception() of AnalogChannel.java line 229 states (if executed):
"Accumulators are only available on slot 1 on channels 1,2"
Reply With Quote
  #5   Spotlight this post!  
Unread 12-02-2012, 08:37
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Using a Gyro on any port (How to code that)?

If you only need low performance from the third gyro you could try integrating the output yourself. Allocate a regular AnalogChannel, poll it regularly, and add the values up.
Code:
pseudocode:
thisSample = gyroAnalog.getValue
thisTimeStamp = Timer.getTimestamp
thisAmountTurned = ((thisSample + lastSample)/2) * (thisTimestamp - lastTimestamp) * (Kgyro)
currentHeading += thisAmountTurned
lastSample = thisSample
lastTimeStamp = thisTimeStamp
lather, rinse, repeat
I doubt you will get performance anywhere near the FPGA, but it is pretty quick to try.
Reply With Quote
  #6   Spotlight this post!  
Unread 12-02-2012, 14:51
ItzWarty ItzWarty is offline
Registered User
FRC #1072 (Harker Robotics)
Team Role: Leadership
 
Join Date: Jan 2012
Rookie Year: 2010
Location: California
Posts: 15
ItzWarty is an unknown quantity at this point
Re: Using a Gyro on any port (How to code that)?

Quote:
Originally Posted by omalleyj View Post
If you only need low performance from the third gyro you could try integrating the output yourself. Allocate a regular AnalogChannel, poll it regularly, and add the values up.
Code:
pseudocode:
thisSample = gyroAnalog.getValue
thisTimeStamp = Timer.getTimestamp
thisAmountTurned = ((thisSample + lastSample)/2) * (thisTimestamp - lastTimestamp) * (Kgyro)
currentHeading += thisAmountTurned
lastSample = thisSample
lastTimeStamp = thisTimeStamp
lather, rinse, repeat
I doubt you will get performance anywhere near the FPGA, but it is pretty quick to try.
If you're running anything else on your robot, it might be worthwhile to run this on a separate thread. I'm not sure how nice Thread.Sleep() is on the robot, though.
__________________
Leader of Team 1072. Software developer of RAF Manager.
Follow me on Twitter: Twitter.com/ItzWarty/
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 12:37.

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