Go to Post Does FIRST know about some rare inverted mushroom that I do not? - sanddrag [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 18-02-2015, 00:59
[HT]3KEZ's Avatar
[HT]3KEZ [HT]3KEZ is offline
Registered User
FRC #4014 (Top Hat Technicians)
Team Role: Electrical
 
Join Date: Feb 2015
Rookie Year: 2015
Location: California
Posts: 5
[HT]3KEZ is an unknown quantity at this point
Question Gyro's angle value going up

Our team has recently run into a snag in our code where our gyro's angle value goes up by 0.001 extremely quickly. We don't know what it is in our code that causes this, but we would like to remove it if possible. We're using command based Java coding, and can post excerpts of our code if need be. Thanks in advance for any help!
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2015, 01:07
tStano tStano is offline
Registered User
AKA: Sparks
no team
Team Role: Electrical
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Madison, WI
Posts: 177
tStano will become famous soon enough
Re: Gyro's angle value going up

A definition of "Extremely Quickly" is needed. 'Gyro Drift' is a real thing. Its part of the physics of gyros that they slowly get off (roughly a degree every second or three). This is (simply put) because you are taking a discrete integral of a noisy signal. You can compensate by resetting your gyro when you're at a known angle, or with some really fancy code, but slowly counting up is a thing gyros do.

If you are seeing huge jumps, then you may have real problems.
Reply With Quote
  #3   Spotlight this post!  
Unread 18-02-2015, 02:02
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Gyro's angle value going up

At the beginning of last year's build, we had four working gyros. One went out last year, unrecognized, which ruined our field coordinates mode (We had a mecanum drive train). The symptoms of that dying gyro sound a bit like yours. During the build this year, we've lost two more. We now have one working KoP gyroscope, and it's in the bag. We could not find a "drop-in" replacement online, so instead we've ordered some 3-axis I2C gyroscopes from Pololu. It's on a closeout discount, but being replaced with a compatible upgrade. They had 189 until we ordered 20. We'll figure out how to use them on our practice 'bot next week.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #4   Spotlight this post!  
Unread 18-02-2015, 19:30
[HT]3KEZ's Avatar
[HT]3KEZ [HT]3KEZ is offline
Registered User
FRC #4014 (Top Hat Technicians)
Team Role: Electrical
 
Join Date: Feb 2015
Rookie Year: 2015
Location: California
Posts: 5
[HT]3KEZ is an unknown quantity at this point
Re: Gyro's angle value going up

"Extremely quickly" meant that the Gyro's angle value went up by approx. 0.2 degrees per second, so it does sound like it could be gyro drift. If it's just a part of the gyro, can we leave it be without the gyro getting confused? Because that's what the team is worried about so far.
Reply With Quote
  #5   Spotlight this post!  
Unread 18-02-2015, 19:49
tStano tStano is offline
Registered User
AKA: Sparks
no team
Team Role: Electrical
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Madison, WI
Posts: 177
tStano will become famous soon enough
Re: Gyro's angle value going up

If you're only using it for autonomous, you should be fine, as it will go off by about 3 degrees over the whole period(.2*15).

However, if you're planning to use it throughout the match(a field-centric drivescheme or on an arm or something) you should look into resetting the sensor when its in a known orientation

Alternately, if you know its a constantish .2 degrees per second, you can account for that when you read the gyro. Start a timer and subtract .2*timerReading whenever you read the gyro. This might be a poor solution because its not a constant .2 degrees per second, but it might get you something better than what you have.

Another solution we're considering is noise reduction. Wrapping the sensor in a few layers of electrical tape(to insulate it so you don't short it) and then in aluminum foil should help block some of the magnetic and electric fields present on your robot. It won't eliminate gyro drift, but it might help to minimize the problem.

Last edited by tStano : 18-02-2015 at 19:54.
Reply With Quote
  #6   Spotlight this post!  
Unread 18-02-2015, 20:07
[HT]3KEZ's Avatar
[HT]3KEZ [HT]3KEZ is offline
Registered User
FRC #4014 (Top Hat Technicians)
Team Role: Electrical
 
Join Date: Feb 2015
Rookie Year: 2015
Location: California
Posts: 5
[HT]3KEZ is an unknown quantity at this point
Re: Gyro's angle value going up

Alright, thanks so much for the help! We'll definitely look into using one of those solutions.
Reply With Quote
  #7   Spotlight this post!  
Unread 19-02-2015, 12:01
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: Gyro's angle value going up

A "cheat" we have used in the past is a gyro reset button. That is, when we know we are at 0 degrees, we make the gyro equal zero.

Another more ambitious route is using vision to check the gyro. This was possible in 2011,12,13, and 14 due to static vision targets. All that was needed was a pose calculation.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
Reply With Quote
  #8   Spotlight this post!  
Unread 22-02-2015, 02:38
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Gyro's angle value going up

Quote:
Originally Posted by faust1706 View Post
A "cheat" we have used in the past is a gyro reset button. That is, when we know we are at 0 degrees, we make the gyro equal zero. .
While we have done this manually in the past, thanks for the reminder! We have "curb feelers" that help us square up with the scoring platforms. (See this link for photos. Maybe we can program an automatic reset to either 0 or 180 (whichever is closer to our current value) when both of them have found the ramp.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #9   Spotlight this post!  
Unread 25-02-2015, 15:36
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: Gyro's angle value going up

Quote:
Originally Posted by GeeTwo View Post
We could not find a "drop-in" replacement online, so instead we've ordered some 3-axis I2C gyroscopes from Pololu. It's on a closeout discount, but being replaced with a compatible upgrade. They had 189 until we ordered 20. We'll figure out how to use them on our practice 'bot next week.
Gus,

I've used similar gyros in the past and was not happy with their performance. In my experience, the Analog Devices gyros seem to give much better results. It's certainly possible that the newer models from Pololu have improved, and I would be interested hearing your opinion of them.

Mike
Reply With Quote
  #10   Spotlight this post!  
Unread 25-02-2015, 19:52
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Gyro's angle value going up

Quote:
Originally Posted by Mike Bortfeldt View Post
I've used similar gyros in the past and was not happy with their performance. In my experience, the Analog Devices gyros seem to give much better results. It's certainly possible that the newer models from Pololu have improved, and I would be interested hearing your opinion of them.
Having learned what I have in the past few days (see this thread on usfirst), I'm not surprised; the gyro class uses hardware acceleration unavailable to an I2C gyroscope. While we will look at the suggestions there, there's the possibility of using an arduino to turn the I2C gyro into a rotation encoder, or just buying an integrated solution. The NavX would also be under consideration if it were actually available.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #11   Spotlight this post!  
Unread 26-02-2015, 08:56
FlyOldPlanes FlyOldPlanes is offline
Registered User
FRC #1592
 
Join Date: Feb 2015
Location: Titusville, FL
Posts: 6
FlyOldPlanes is an unknown quantity at this point
Re: Gyro's angle value going up

If you want to null out a small rate like that, you can use the setDeadband method in the Gyro class. we were a little confused since it shows up in the c++ version of the code, but not the java version. Look at the gyro.java code posted here:

https://usfirst.collab.net/gerrit/gitweb?p=allwpilib.git;a=blob;f=wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/Gyro.java;h=ea1e1cc301c71243e091206312fa281fb2f5e5 87;hb=HEAD

The setDeadband is not made public, I don't know why. we just copied the code as a newGyro.java class in our project and made it public. It seems to work fine so far. You will lose a little accuracy with a larger deadband, but if it is small, it most likely won't be a problem.

Hope this helps,

Lennie
Reply With Quote
  #12   Spotlight this post!  
Unread 26-02-2015, 10:17
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: Gyro's angle value going up

Quote:
Originally Posted by GeeTwo View Post
... While we will look at the suggestions there, there's the possibility of using an arduino to turn the I2C gyro into a rotation encoder, or just buying an integrated solution. The NavX would also be under consideration if it were actually available.
Gus,

If you are looking for a replacement for the old KOP gyro, either the EVAL-ADXRS642Z or the EVAL-ADXRS652Z should work. Both are 0-5v analog gyros and should be a fairly easy replacement for what you are used to. In the past, I've also used an Arduino to do the integration of the gyro rate signal for both analog and SPI gyros - so that is a valid option as well.

Mike
Reply With Quote
  #13   Spotlight this post!  
Unread 26-02-2015, 10:37
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Gyro's angle value going up

Quote:
Originally Posted by Mike Bortfeldt View Post
Gus,

If you are looking for a replacement for the old KOP gyro, either the EVAL-ADXRS642Z or the EVAL-ADXRS652Z should work. Both are 0-5v analog gyros and should be a fairly easy replacement for what you are used to. In the past, I've also used an Arduino to do the integration of the gyro rate signal for both analog and SPI gyros - so that is a valid option as well.

Mike
Five thousand dollars for a minimum order of 100? Or is there someone who has them for retail? Actually, even if there is, I'd rather go with the integrated all-axes solution with built-in integration and Kalman filtering at $130 than a single axis analog gyro at $50.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #14   Spotlight this post!  
Unread 26-02-2015, 10:42
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: Gyro's angle value going up

Gus,

The EVAL parts can be ordered singularly at $50 or $70 depending on the model. Look near the bottom of the web page.

Mike
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:27.

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