Go to Post I've learned that the measure of success isn't the money you make, the education you get, or the car you drive. Your success can only be measured in the amount of people in whose lives you've made a difference and the size of your heart. - Amanda Morrison [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 10-02-2006, 22:09
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Gyro not working in Autonomous?

The students and I have been banging our head on this one:

Our gyro is working fine during regular operation, but during autonmous mode Get_Gyro_Angle() always returns 0. I've even managed to reduce this down to the fairly minimal code below:

Code:
void User_Autonomous_Code(void)
{
  pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
  pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
  relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
  relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
  relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
  relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;

  while (autonomous_mode)   /* DO NOT CHANGE! */
  {
    
    if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
    {
        Getdata(&rxdata);   

        Camera_Handler();
        Servo_Track();

        printf("%d ",(int)Get_Gyro_Angle());

        Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

        Putdata(&txdata);  
    }
  }
}
Any ideas on this one? Our current bot really needs the gyro for feedback in auto mode. The camera is working fine.
  #2   Spotlight this post!  
Unread 10-02-2006, 22:23
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Gyro not working in Autonomous?

Have you called BOTH Start_Gyro_Bias_Calc() and Stop_Gyro_Bias_Calc() before autonomous executes?
  #3   Spotlight this post!  
Unread 10-02-2006, 22:30
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Gyro not working in Autonomous?

Quote:
Originally Posted by Abwehr
Have you called BOTH Start_Gyro_Bias_Calc() and Stop_Gyro_Bias_Calc() before autonomous executes?
No, I don't, but that's because I know the bias already. I do call

Code:
Initialize_Gyro();
Initialize_ADC();
Set_Gyro_Bias(1092); //1092 for kit gyro, 1003 for ADXSR300
in my User_Initialization () function, which is called before autonomous mode triggers. And the gyro is working perfectly in user mode (indeed, if I flip back and forth from autonomous mode to user mode the gyro always works in user mode)
  #4   Spotlight this post!  
Unread 10-02-2006, 22:49
jaustin jaustin is offline
Registered User
AKA: Jeff Austin
FRC #2930 (The Taterbotz)
Team Role: Mentor
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Snohomish, WA
Posts: 33
jaustin is an unknown quantity at this point
Re: Gyro not working in Autonomous?

We are having the same problem, see our symptoms in the gyro code sticky thread. I've also posted the code we are trying to use.
  #5   Spotlight this post!  
Unread 10-02-2006, 23:00
devicenull devicenull is offline
Robot? We need a robot?
no team
 
Join Date: Sep 2004
Rookie Year: 1234
Location: n/a
Posts: 359
devicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nice
Re: Gyro not working in Autonomous?

It's a simple problem to fix:
The call to update the gyro is preformed in Process_Data_From_Local_IO, which is not called during autonomous mode. If you copy the code for it to the User_Autonomous_Code loop, everything will work.

To be specific, this code needs to be in your autonomous loop:
Code:
if(Get_ADC_Result_Count())
  {
    	Process_Gyro_Data();
	
    	Reset_ADC_Result_Count();
  }
Took me a little while to figure that out
  #6   Spotlight this post!  
Unread 10-02-2006, 23:31
jaustin jaustin is offline
Registered User
AKA: Jeff Austin
FRC #2930 (The Taterbotz)
Team Role: Mentor
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Snohomish, WA
Posts: 33
jaustin is an unknown quantity at this point
Smile Re: Gyro not working in Autonomous?

Devicenull,
YOU ARE AWESOME!

I was just getting ready to type a note asking why the Process_data... function might not be running in my code and there was your note! It is very confusing since I've been working with the EDU all summer and it appears to run that function during autonomous.

You're a life saver!
  #7   Spotlight this post!  
Unread 11-02-2006, 00:04
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Gyro not working in Autonomous?

Quote:
Originally Posted by devicenull
It's a simple problem to fix:
The call to update the gyro is preformed in Process_Data_From_Local_IO, which is not called during autonomous mode. If you copy the code for it to the User_Autonomous_Code loop, everything will work.
You da man! I was just trying to piece together the ADC event loop and had done some code to make sure Timer 2 was getting called, and got this message. Thanks for saving us some significant debug time.
  #8   Spotlight this post!  
Unread 11-02-2006, 01:28
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Gyro not working in Autonomous?

I've updated the gyro documentation to make it clear that Process_Gyro_Data( ) needs to be called from User_Autonomous_Code( ). For grins, I also updated the code in frc_gyro.zip.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
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
Labview used to debug the Gyro joshR515 National Instruments LabVIEW and Data Acquisition 1 09-02-2006 20:56
Autonomous robots working & interacting with each other & their environment. Elgin Clock Math and Science 0 19-05-2005 01:00
Next Years Game? Jeremy General Forum 49 27-04-2004 01:53
Despite what IFI says, you can configure autonomous from OI... TedP Programming 19 31-03-2004 10:09


All times are GMT -5. The time now is 09:59.

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