Go to Post IRI: where egos go to die...uhm..I mean fly! - Koko Ed [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 12-11-2001, 22:31
wes16zeus's Avatar
wes16zeus wes16zeus is offline
Registered User
#0231 (High Voltage)
 
Join Date: Oct 2001
Location: Pasadena/TX
Posts: 20
wes16zeus is an unknown quantity at this point
Send a message via AIM to wes16zeus
Question question about gyrochip

In the code yall defined your filter as:

sensor1filt = sensor1filt + ((256 + sensor1 - sensor1filt)*KFilt/200)
-
(256*KFilt/200)

What is KFilt?
What is Yaw rate?
In the code it says...... k = 1 to 85........k = 1 to 50.........k = 1
to
75...........what do this #'s mean and why are they used?

sensor1filt var ???


i would appreciate you all answering these
questions. the full source can be found on the white pages (page 2) Auto Balance Gyro Chip. Thank you and let me know if you all have any questions
about
animation.
__________________
Wesley Geddes, Owner
A Tech Solutions
3DS MAX HELPER
  #2   Spotlight this post!  
Unread 13-11-2001, 12:21
Kyle Gilbert's Avatar
Kyle Gilbert Kyle Gilbert is offline
Registered User
#0045 (New CD Name KyleGilbert45)
 
Join Date: May 2001
Location: New CD Name KyleGilbert45
Posts: 47
Kyle Gilbert is an unknown quantity at this point
Send a message via AIM to Kyle Gilbert Send a message via Yahoo to Kyle Gilbert
Cool autobalance.........

Hey


I wish i could help you out on this one, but the autobalance software or any or the programming or electronics for our robot isnt my specialty. Maybe if you email Andy Baker he might be able to help you or give you a contact for the engineers that wrote the autobalance code. I'm also guessing that by the time i post this message Andy will have already posted a reply. lol......


Kyle Gilbert
Team 45 TechnoKats Robotics Team
  #3   Spotlight this post!  
Unread 13-11-2001, 13:59
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Explaining the Sample Gyrochip Code

>In the code yall defined your filter as:
>
>sensor1filt = sensor1filt + ((256 + sensor1 - sensor1filt *KFilt/200) - (256*KFilt/200)
>
>What is KFilt?

KFilt is a constant that must be chosen experimentally to give you the behavior you want. Its range will necessarily be between 0 and 200 because if KFilt is 0, the filtered sensor value will never change, and if it's 200, the effect is of no filter at all. (If it were to be more than 200, your filtered value would fluctuate wildly whenever the sensor reading changed.)

To understand this, simplify
Code:
sensor1filt = sensor1filt + ((256 + sensor1 - sensor1filt)*KFilt/200) - (256*KFilt/200)
and you get
Code:
sensor1filt = sensor1filt + ((sensor1 - sensor1filt)*KFilt/200)
(The reason for the extra terms is to avoid dividing a negative number -- a well known problem on the BASIC Stamp.) What we see from this simplification is that each time through the loop, a percentage of the difference between the current sensor reading and the previous filtered value is added to the previous filtered value to give you a new filtered value. The effect of this is to "smooth out" the input from the sensor. (That is the purpose of this type of filter.) In my experience, you will probably want to set KFilt to somewhere between 20 and 120 (10-60% filtering).


>What is Yaw rate?

Yaw rate is the rate at which a body turns about a vertical axis. In other words, how fast something is turning to the left or right. This is actually different than what we were measuring for the bridge balancing problem we had to tackle this past year. To solve this problem, we had to turn the gyro sensor so that we were measuring the robot's pitch rate (the rate at which the nose of the robot pitched up and down.) I guess the yaw rate sensor is commonly called that because that is the application for which it is used in the automotive industry.


>In the code it says......
>k = 1 to 85........k = 1 to 50.........k = 1 to 75
>...........what do this #'s mean and why are they used?

These are timing loops. For example,
Code:
for k = 1 to 75
Serout USERCPU, OUTBAUD, [...]
next
simply executes the Serout command 75 times. I believe the TechnoKats had to figure out by trial and error how many times to repeat each loop in order to balance the bridge.


>sensor1filt var ???

Since sensor1 is a byte variable, sensor1filt needs to be at least byte sized.


Hope it helps.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 13-11-2001 at 15:42.
  #4   Spotlight this post!  
Unread 13-11-2001, 16:24
JHBurch JHBurch is offline
Registered User
#0045 (TechnoKats)
 
Join Date: Nov 2001
Location: Kokomo, IN
Posts: 10
JHBurch is an unknown quantity at this point
Smile re: question about gyro chip

Greg provided an excellent explanation, but I'll throw in my two cents worth anyway.

One way to get a good look at how the filter works is to use Excel to make a graph. Here's a step-by-step guide if you need it.

Put the number 128 in the cells A1, B1 and A2. Put the number 23 in cell C1. In Cell B2 put the following equation (without the quotes): "=B1+(A2-B1)*$C$1/200" then copy this equation and paste it for 30 or 40 rows down the B column starting at B3. Ignore the numbers that it calculates for now. The numbers you put in column A represent the Angle Rate Sensor input and the numbers in column B are the filtered signal that's being used by the code. Try this: put the number 150 in cells A3 through A20, then put the number 120 in cells A21 through the end (however far you copied column B to). Select A1 through the last row in column B (e.g. A1:B40) and hit the chart button. Select a line chart in the chart wizard and keep hitting the next / finish buttons until it draws a chart. If the y axis starts at 0, double click the y axis and change the min and max values to 110 and 160. Change the value in C1 and see how this effects the filtered values.

As for the numbers in the for - next loops, There were indeed established by trial and error. When "Balance Mode" is initiated, the code takes over control of the drive motors (you'll notice that the code ignores the joystick input within this routine) and starts driving at a steady rate in one direction while monitoring the Angle Rate Sensor. When a threshold value is reached on the sensor (also determined by trial and error) the robot automatically changes direction by sending a fixed value to the drive motors each time through the loop. Then it changes direction again, this time at a slower speed for a different number of loops. Separate code had to be written for the starting up the ramp in forward or reverse because the drive motors react differently in the two directions.

Hope this sheds a little more light. Feel free to contact me if you want more details.
Attached Files
File Type: xls filter example.xls (19.0 KB, 57 views)
__________________
Jeff Burch
TechnoKats #45
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
my idea of a question forum... Ken Leung General Forum 12 30-11-2002 12:17
Under or Over? To tank or Not to tank that tis the question! archiver 2001 2 23-06-2002 22:53
MnM EASY Question of the Day Winners! Mike Bonham General Forum 22 03-05-2002 21:21
Chief Delphi Site Question Mike Bonham General Forum 1 16-02-2002 22:18
Rookie Programmer has question about the default code DanL Programming 3 26-01-2002 19:59


All times are GMT -5. The time now is 17:18.

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