OCCRA
Go to Post No, Dave says "that's PUMP" - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media  
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 03-05-2018, 01:34 PM
3674 3674 is offline
Registered User
FRC #3674
 
Join Date: Jan 2018
Location: usa
Posts: 39
3674 is an unknown quantity at this point
Gyro behavior different on competition field

Facts:
1. We have an ADXRS450 gyro
2. We have it resetting to zero at the end of every time it's called (and it resets itself when robot restarts)
3. We have done a teleop test to make sure that when we turn it right, that it shows positive, and left is negative and the values reflect the angle we are turning (45, 90, 180, etc.)
4. Back in our workshop, we have run the auto modes and it turns perfectly in the correct directions. We are starting center, then driving forward, turning 45 degrees left or right based on the color, turning back 45 degrees to face forward, lifting the cube, driving forward, and then shooting the cube out into the switch
5. We confirmed that it did exactly what is was supposed to do on the practice field at the tournament.
6. We went to play on the field, using it for the first time out on the actual field. Instead of turning right to 45 degrees and stopping, it went all the ways to 315 degrees and stopped.
7. The program believed that 315 degrees was the 45 degrees, but it continued running the other commands that were PID. If a setpoint is not reached, it wouldn't have executed the rest of the commands.

Any ideas why the gyro would have operated one way everywhere else, but not when we put it on the field?

Thank you.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-05-2018, 01:37 PM
JefferMC JefferMC is offline
Registered User
AKA: Jeff Corbett
FRC #1319 (Flash)
Team Role: Mentor
 
Join Date: Nov 2012
Rookie Year: 2005
Location: United States
Posts: 171
JefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant futureJefferMC has a brilliant future
Re: Gyro behavior different on competition field

Can you link your repository (GITHUB, etc.) so that we can take a gander at your code to see if anything jumps out?
Reply With Quote
  #3   Spotlight this post!  
Unread 03-05-2018, 05:02 PM
3674 3674 is offline
Registered User
FRC #3674
 
Join Date: Jan 2018
Location: usa
Posts: 39
3674 is an unknown quantity at this point
Re: Gyro behavior different on competition field

https://github.com/CloverBots/PowerUp2018
Reply With Quote
  #4   Spotlight this post!  
Unread 03-05-2018, 06:28 PM
Peter Johnson Peter Johnson is offline
Volunteer WPILib Developer, CSA
no team (WPILib)
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 536
Peter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond repute
Re: Gyro behavior different on competition field

In both your description and my reading of your code, you reset the gyro at the *end* of the rotate command (Rotate::IsFinished). My guess is what's happening is the gyro is not being reset prior to the first time you do a rotate (which matches your symptoms). Since the gyro is being initialized at the time you turn on the robot / restart your code, and not being reset prior to the first rotate command, the gyro reading is going to be relative to the robot orientation when the code boots, which could easily not the same as its initial orientation on the field (on the practice field, it might have been, if you rebooted or turned on the robot after placing it on the field).

My recommendation would be to reset the gyro in AutonomousInit().
__________________
WPILib Developer, 2014-Present:
  • Author of cscore - WPILib CameraServer for 2017+
  • Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC
Mentor, Team 294, 2008-2018 (World Champions FRC 2010 & FTC 2008)
Reply With Quote
  #5   Spotlight this post!  
Unread 03-05-2018, 06:44 PM
3674 3674 is offline
Registered User
FRC #3674
 
Join Date: Jan 2018
Location: usa
Posts: 39
3674 is an unknown quantity at this point
Re: Gyro behavior different on competition field

we will do that, but we thought it strange that the amount that it turned 315 instead of 45, (which is 45 degrees off from a 360). Could it actually have affected it that much? Seems cooincidental???
Reply With Quote
  #6   Spotlight this post!  
Unread 03-05-2018, 07:04 PM
3674 3674 is offline
Registered User
FRC #3674
 
Join Date: Jan 2018
Location: usa
Posts: 39
3674 is an unknown quantity at this point
Re: Gyro behavior different on competition field

I spoke too soon. This is kind of fun (well, sort of since it messed us up in quarterfinals). I'll bet the drive team placed the robot down pointing towards 270 degrees, so the gyro calculated that 45 degrees is to the right, which is actually at 315 degrees if you were facing forward. Then they moved the robot straight forward to the zero position. Then when the auto mode was ran, the robot rotated to that 315 degrees, thinking it was 45 since that was what it was when they turned the robot on!
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:46 AM.

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


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi