Go to Post We do FRC to inspire and to be inspired. - Basel A [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-03-2013, 00:22
zatch bell stev zatch bell stev is offline
Registered User
FRC #2523
 
Join Date: Jan 2012
Location: vermont
Posts: 14
zatch bell stev is an unknown quantity at this point
Gyro problem, please help!

Our gyro is not working properly. Gyro is connected to the analog breakout port 1 and signal is going to the output which is closer to the rate sign ( its not the temperature). We are running it through java.

when we enable the teleoperated mod it resets itself but its drifting the angle even when its stable. i already checked the sensitivity and its just multiplying with other numbers so when it turns it gives lower or higher numbers.At 0.007 i can get the degree for a while (around 10 sec)but it keep increasing even when i'm moving it. here is my simple code for it ...


package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Gyro;

import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;


public class RobotTemplate extends SimpleRobot {

private Gyro gyro = new Gyro(1);

public void autonomous() {
}


public void operatorControl() {
double number1 = 0;

gyro.reset();

while (isEnabled() && isOperatorControl()) {
Timer.delay(0.05);

double number = gyro.getAngle();

System.out.println(number);

}
}


public void test() {
}
}

thanks for your helps.
  #2   Spotlight this post!  
Unread 20-03-2013, 00:36
Gigakaiser Gigakaiser is offline
Registered User
AKA: Brandon Hjelstrom
FRC #0987 (High Rollers)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Las Vegas
Posts: 67
Gigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant future
Re: Gyro problem, please help!

Gyros tend to drift, but not by large amounts. Make sure your robot isn't moving when you power on to minimize the drift. We've found that the normal gyro drift doesn't affect us much during autonomous, and during teleop we always use offsets rather than absolute angles when giving gyro-based commands. (ie. use the current gyro angle + some offset rather than using an absolute angle)
__________________
FRC Team 987 - It's not enough
  #3   Spotlight this post!  
Unread 20-03-2013, 00:39
MagiChau's Avatar
MagiChau MagiChau is offline
Registered User
AKA: Michael Chau
FRC #0085 (B.O.B. (Built on Brains))
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Zeeland, Michigan
Posts: 875
MagiChau is just really niceMagiChau is just really niceMagiChau is just really niceMagiChau is just really nice
Re: Gyro problem, please help!

Code wise if you are using the gyro from the Kit of Parts then you should keep its sensitivity at 0.007 so the getAngle() reports in degrees.

How much is it drifting? It is normal for the gyro to drift a fraction of a degree because of the nature of a gyro being a rate of change sensor. To get the current angle the gyro is facing it sums up all the changes in angle. The calculated rate of change is not 100% accurate and thus has error. Due to this error it builds up as more and more of these are added up as drift. You would have to reset the gyro when you know its heading to reset the error in getAngle() to 0.
  #4   Spotlight this post!  
Unread 20-03-2013, 00:39
zatch bell stev zatch bell stev is offline
Registered User
FRC #2523
 
Join Date: Jan 2012
Location: vermont
Posts: 14
zatch bell stev is an unknown quantity at this point
Re: Gyro problem, please help!

What do you mean by offset ?
  #5   Spotlight this post!  
Unread 20-03-2013, 00:46
zatch bell stev zatch bell stev is offline
Registered User
FRC #2523
 
Join Date: Jan 2012
Location: vermont
Posts: 14
zatch bell stev is an unknown quantity at this point
Re: Gyro problem, please help!

Quote:
Originally Posted by MagiChau View Post
Code wise if you are using the gyro from the Kit of Parts then you should keep its sensitivity at 0.007 so the getAngle() reports in degrees.

How much is it drifting? It is normal for the gyro to drift a fraction of a degree because of the nature of a gyro being a rate of change sensor. To get the current angle the gyro is facing it sums up all the changes in angle. The calculated rate of change is not 100% accurate and thus has error. Due to this error it builds up as more and more of these are added up as drift. You would have to reset the gyro when you know its heading to reset the error in getAngle() to 0.
Earlier tonight we got it drifted 1 degree in 3 minutes while we were suspecting form the temperature ,we put a fan on the gyro and it was fine. So we tried it after 1 hour and it start changing 1 degree a minute. Is there any library or source for the temp output on the gyro ?
  #6   Spotlight this post!  
Unread 20-03-2013, 00:47
Gigakaiser Gigakaiser is offline
Registered User
AKA: Brandon Hjelstrom
FRC #0987 (High Rollers)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Las Vegas
Posts: 67
Gigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant futureGigakaiser has a brilliant future
Re: Gyro problem, please help!

Quote:
Originally Posted by zatch bell stev View Post
What do you mean by offset ?
For example, if you know the robot is straight and you want to turn 30 degrees (but your gyro drift is adding up), you could turn to gyro.getAngle() + 30.0. Another solution, as MagiChau wrote, is to reset the gyro if you know where your robot is pointed.
__________________
FRC Team 987 - It's not enough

Last edited by Gigakaiser : 20-03-2013 at 00:54.
  #7   Spotlight this post!  
Unread 20-03-2013, 00:51
zatch bell stev zatch bell stev is offline
Registered User
FRC #2523
 
Join Date: Jan 2012
Location: vermont
Posts: 14
zatch bell stev is an unknown quantity at this point
Re: Gyro problem, please help!

Quote:
Originally Posted by Gigakaiser View Post
For example, if you know the robot is straight and want to turn 30 degrees (but your gyro drift is adding up), you could turn to gyro.getAngle() + 30.0. Another solution, as MagiChau wrote, is to reset the gyro if you know where your robot is pointed.

I already written a program for that but never get to test it because our robot is packed up and only thing i could access from our lab is bunch of sensors and a crio. does is work properly when you use it like that ?
  #8   Spotlight this post!  
Unread 20-03-2013, 02:18
zatch bell stev zatch bell stev is offline
Registered User
FRC #2523
 
Join Date: Jan 2012
Location: vermont
Posts: 14
zatch bell stev is an unknown quantity at this point
Re: Gyro problem, please help!

Quote:
Originally Posted by Gigakaiser View Post
For example, if you know the robot is straight and you want to turn 30 degrees (but your gyro drift is adding up), you could turn to gyro.getAngle() + 30.0. Another solution, as MagiChau wrote, is to reset the gyro if you know where your robot is pointed.
public void operatorControl() {

double lastAngle = 0;
double newAngle =0;
double realAngle = 0;
gyro.reset();
while (isEnabled() && isOperatorControl()) {
double move = y.getY();
motor.set(move/5);

if (move > 0.01 || move < -0.01) {
newAngle = gyro.getAngle();
lastAngle = realAngle;
} else {
realAngle = newAngle + lastAngle;

gyro.reset();

}

System.out.println(realAngle);
System.out.println(move);
Timer.delay(0.05);

}
}
do you think this will work ?
  #9   Spotlight this post!  
Unread 20-03-2013, 07:19
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,533
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Gyro problem, please help!

Zach, 1 degree every 1-3 minutes is actually good performance from the KOP gyro. As far as I know, you're not going to be able to improve on it substantially.

Perhaps you can tell us the application. I can't think of many applications for a gyro that would be messed up by 1 degree over the course of the match.
Closed Thread


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 23:16.

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