Go to Post Your drivetrain is THE most important system on your robot. Don't rob from it. - Monochron [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 20-06-2008, 12:53
John Gutmann John Gutmann is offline
I'm right here
AKA: sparksandtabs
FRC #0340 (GRR)
Team Role: Mechanical
 
Join Date: Feb 2005
Rookie Year: 2004
Location: rochester
Posts: 804
John Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant futureJohn Gutmann has a brilliant future
Send a message via AIM to John Gutmann Send a message via MSN to John Gutmann Send a message via Yahoo to John Gutmann
Re: BEI Gyro Accuracy

I guess the part I am really interested in is this, because this is what I am having troubles with:

Code:
/*************************************************
Timer ISR to grag Gyro value at rate 
determined in SetuoTimer2
**************************************************/
ISR(TIMER2_OVF_vect)
{
  //Toggle the IO pin to the other state.
  //digitalWrite(TOGGLE_IO,!digitalRead(TOGGLE_IO));
sample_accum  += analogRead(GyroPin);
sample_counter ++;
  if (sample_counter == SAMPLES_PER_UPDATE)
  {
    val = (sample_accum/SAMPLES_PER_UPDATE)-gyroBias;
    if (val < -DEADBAND || val > DEADBAND)
    {
    gyro_angle += (long)val;
    }
    sample_accum = 0;
    sample_counter = 0;
  }
  //Capture the current timer value. This is how much error we
  //have due to interrupt latency and the work in this function
latency=TCNT2;
  //Reload the timer and correct for latency.
TCNT2=(latency + timerLoadValue);
}

What why are you toggling a pin?
The latency part is just accounting for the time spent processing?

Other then those 2 things my ISR is basically the same.
I cant really post the code now because I am at work, but I can give a brief pseudo coding of it.

Code:
get adc reading
if it is less then dead band
     then subtract from position
if it is greater then dead band
     then add to position
else do nothing

send position over USART
I know I am technically using an accumulated rate but lets assume I am using a Riemann sum with a coefficient of 1.

Thanks,
John Gutmann

EDIT: I think when I get home I will try to eliminate the dead band, and see if that will help any.
 


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
BEI Gyro John Gutmann Electrical 3 18-06-2008 17:36
Weapon Accuracy? scitobor 617 Programming 15 12-02-2006 22:16
servo output accuracy NextPerception Programming 9 07-02-2006 11:23
BEI GyroChip Problems Andrew Blair Programming 12 07-12-2005 18:02
BEI Gyrochip CyberWolf_22 Electrical 3 15-01-2005 16:27


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

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