Go to Post If Amanda is 'old', I am beginning to feel like a fossil.... - Chris Fultz [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 22-03-2007, 19:02
cprogrammer's Avatar
cprogrammer cprogrammer is offline
Registered User
FRC #1595 (Gremlins)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Washington
Posts: 42
cprogrammer will become famous soon enoughcprogrammer will become famous soon enough
Gyro Autonomous Problems

The problem is that when you switch to autnomous code the gyro gains numbers very rapidly into the 10000's then once we go back to Process_Data_From_Master_uP the gyro gains numbers normally. What is the problem with this.
  #2   Spotlight this post!  
Unread 22-03-2007, 19:23
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,854
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Gyro Autonomous Problems

Sounds like you're adding the current gyro value in rapidly in autonomous, but slowly in Operator mode without taking the rate into account.
Are you using Kevin Watson's code as a base?
How and where in the code are you updating the gyro?
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 22-03-2007, 19:32
cprogrammer's Avatar
cprogrammer cprogrammer is offline
Registered User
FRC #1595 (Gremlins)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Washington
Posts: 42
cprogrammer will become famous soon enoughcprogrammer will become famous soon enough
Re: Gyro Autonomous Problems

The Code looks like this in autonomous
while (autonomous_mode)
{
if(Get_ADC_Result_Count())
{
Process_Gyro_Data();
}
etc etc etc.
The only gyro things in here are gyro = Get_Gyro_Angle();
and gyro is a variable declared as long gyro;
We are using kevins camera code as a base and combined the encoder and gyro code into it using his instructions.

in Process_Data_From_Master_uP the Gyro is initialized in User_Initialization and is calibrated in Process_Data_From_Master_uP using the stop and start bias offset. Then it is using kevins temp_gyro_angle = Get_Gyro_Angle(); to get the angle of the gyro. If you have anymore question feel free to ask.
  #4   Spotlight this post!  
Unread 22-03-2007, 20:41
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,854
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Gyro Autonomous Problems

Code:
  if(Get_ADC_Result_Count())
  {
    Process_Gyro_Data();
 
    Reset_ADC_Result_Count();
  }
should be called all the time, in autonomous mode or not.

If you follow the default style then the code above would be in Process_Data_From_Local_IO() and you'd need to add a call to Process_Data_From_Local_IO() within the User_Autonomous_Code() autonomous_mode loop (but outside the 26.2ms slow loop).
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #5   Spotlight this post!  
Unread 23-03-2007, 11:23
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 747
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: Gyro Autonomous Problems

Have you caclulated the Bias for the gyro?

This is the value for the null (Not Rotating) output of the gyro. Until you calculate and save this value, the Gyro code will "Think" it's rotating very fast conter clockwise.

The bias is caclulated by taking the average of many gyro values while the robot is stationary. Kevin has provided an easy way to do this...

First you call Start_Gyro_Bias_Calc() and then a few seconds later you call Stop_Gyro_Bias_Calc(). You must be calling Process_Gyro_Data() thoughout this time interval.

You probably don't want to do this at the start of tele-operated mode, or autonomous mode, unless you are willing to keep the robot still for a few seconds.

In our code we do this ONCE when the robot enters "Disabled" mode. We figure that it will be in that state for at least two seconds. Just in case we save the gyro bais in EEPROM. If we don't get a full two seconds in disable mode we use the last saved vale from EEPROM.

To debug this, print out the "Rate" value every second. That way you'll know if the gyro thinks it's turning or not. Use Get_Gyro_Rate();
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
  #6   Spotlight this post!  
Unread 23-03-2007, 14:28
cprogrammer's Avatar
cprogrammer cprogrammer is offline
Registered User
FRC #1595 (Gremlins)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Washington
Posts: 42
cprogrammer will become famous soon enoughcprogrammer will become famous soon enough
Re: Gyro Autonomous Problems

Thanks, The Reset_ADC_Result_Count(); did the trick thank you so much Mark Mcleod.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with the Gyro Guy_E Programming 21 04-12-2006 17:23
Gyro not working in Autonomous? kaszeta Programming 7 11-02-2006 01:28
Problems with the gyro Conan Programming 7 06-02-2006 01:45
Yaw Rate Gyro Problems RetroKamikaze Programming 3 27-01-2006 20:55
Gyro Code Problems railerobotics Programming 8 27-01-2006 10:45


All times are GMT -5. The time now is 19:41.

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