Go to Post Enjoy doing what you do. If you enjoy your life, what you're doing in it, and how you're living it, then what other people say or think doesn't matter. - Beth Sweet [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 10-04-2003, 22:32
Bruce C.'s Avatar
Bruce C. Bruce C. is offline
Registered User
#0647 (The Cyber Wolf Corps)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Killeen, Texas
Posts: 65
Bruce C. will become famous soon enough
Well, that attachment didn't work. Let me see if I can figure out how to attach a file. If the attachment below doesn't work, try this: http:
//members.roadfly.com/weaponeer/Yaw Rate Sensor Logic.doc

All on one line.

Bruce C.
Attached Files
File Type: doc yaw rate sensor logic.doc (25.0 KB, 130 views)
Reply With Quote
  #17   Spotlight this post!  
Unread 11-04-2003, 09:34
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
previous post

The previous post has a small code snippet that shows how they're summing up the gyro inputs to make the 90 degree turn:

Code:
drive_L = 254	' start right turn
drive_R = 1	

select sensor1			'select yaw rate sensor
	case 0 to 127		' turning left
		new_ct = 127-sensor1
		yaw_ct = yaw_ct - new_ct
	case 128 to 255		' turning right
		new_ct = sensor1 -127
		yaw_ct = yaw_ct + new_ct
endselect

if yaw_ct > 5262  then	‘count has reached 5262 and passed 90
	drive_L = 127  	‘stop turn
	drive_R = 127
endif

debug ?yaw_ct		'display count value in debug screen
The code in the select statement can be simplified and the case statement eliminated. When the gyro is less than 127 the value of yaw_ct = yaw_ct - new_ct. Since new_ct = 127 - sensor1, the equivalent expression is yaw_ct = yaw_ct - (127 - sensor1), reduced to yaw_ct = yaw_ct + sensor1 - 127.

When the gyro is greater than 127 the expression is yaw_ct = yaw_ct + new_ct, where new_ct = sensor1 - 127. This also simplifies to yaw_ct = yaw_ct + sensor1 - 127.

So the following code will work the same way. I added a deadband around 127 for the gyro so that it doesn't start adding up noise if the robot is sitting still. If yaw_ct was initialized to zero and some noise creeps in then yaw_ct may underflow and trigger the IF statement. If you initialize yaw_ct to something like 10000 then you can use it for both clockwise and anti-clockwise turns. 15,262 would be to the cutoff turning left and 4738 would be the cutoff to the right.

Code:
'constants
gyro_deadband 	CON 	4	'gyro deadband
yaw_ct_base	CON	10000	'base value for yaw_ct
yaw_ct_stop 	CON	5262	'yaw counts for 90 degrees

'initialize
yaw_ct = yaw_ct_base

'start main loop
DO

SERIN...

drive_L = 254		'start right turn
drive_R = 1	

if abs(sensor1-127) > gyro_deadband then 
	yaw_ct = yaw_ct + sensor1 - 127
endif

'stop after turning 90 degrees
if abs(yaw_ct - yaw_ct_base) > yaw_ct_stop then	
	drive_L = 127  	'stop turn
	drive_R = 127
endif

debug ?yaw_ct		'display count value in debug screen

SEROUT..

LOOP

Last edited by seanwitte : 11-04-2003 at 09:50.
Reply With Quote
  #18   Spotlight this post!  
Unread 11-04-2003, 10:30
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Caleb - yes, the yaw sensor output is linear.

127 is zero degrees per second turn rate

128 is 0.586 degrees per second turn rate

191 is 37.5 degrees per second turn rate

254 is 75 degrees per second turn rate

and the reason its SO EASY to use the signal for a compass heading, is the SW samples the signal at a fixed rate (about 26mS)

so when you add every sample (subtracting 127 first) then you are integrating the signal, turning degrees/second into degrees!

the only difference is its not normalized into units of degrees - it comes out something like 65 counts = 1 degree.

Its a big number, thats why you need a VAR WORD to hold it - and dont forget that PBASIC always does math with 16bit registers anyway so you dont have to do anything special to look for things like

if angle >20000
Reply With Quote
  #19   Spotlight this post!  
Unread 11-04-2003, 15:41
narenr narenr is offline
Registered User
#0589 (Falk0n)
 
Join Date: Jan 2003
Location: La Crescenta, CA
Posts: 43
narenr is an unknown quantity at this point
Send a message via AIM to narenr
Our team used the gyro as part of our autonomous mode to tell us when we have turned a full 180 so we would know when to straighten out. We integrated the values and did a bit of scaling to give us angle measurements from the 0-255. This allowed us to better control the "dead reckoning" and make it a little less "dead."
Reply With Quote
  #20   Spotlight this post!  
Unread 11-04-2003, 16:40
Caleb Fulton's Avatar
Caleb Fulton Caleb Fulton is offline
Z = Z^2 + C ......WHEEEE!
AKA: aXvXiA
#0461 (West Side Boiler Invasion)
Team Role: College Student
 
Join Date: Dec 2002
Location: West Lafayette, Indiana
Posts: 205
Caleb Fulton has a spectacular aura aboutCaleb Fulton has a spectacular aura aboutCaleb Fulton has a spectacular aura about
Send a message via AIM to Caleb Fulton
Cool! That's great info for future reference...

Thanks!
__________________
Reply With Quote
  #21   Spotlight this post!  
Unread 11-04-2003, 18:50
Bruce C.'s Avatar
Bruce C. Bruce C. is offline
Registered User
#0647 (The Cyber Wolf Corps)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Killeen, Texas
Posts: 65
Bruce C. will become famous soon enough
Thanks

seanwitte,

Thanks for that bit of code and tutorial. That would certainly be more efficient than the way I started out. My excuse is that I am not a programmer. In fact, my favorite programming language is solder. I got my EE degree when we still designed with tubes. Nowadays I just try to give the students an idea, and let them run with it. Works good that way.

Thanks again,
Bruce C.
Reply With Quote
  #22   Spotlight this post!  
Unread 11-04-2003, 22:48
GregT GregT is offline
Registered User
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: FL
Posts: 400
GregT will become famous soon enough
Send a message via AIM to GregT
Care to listen to my input? Im glad to hear so

The gyro is all fun and good to play with, but quickly becomes unpratical to use as a sort of compass as suggested earlier. Here are my team's reasons for pulling our nav gyro off:

1) Our robot turns faster then the gyro can help us. Why slow your robot down so the gyro can handle the speed?

2) The basic stamp is too slow to use with the gyro by itself. If you have a spiffy custom electronics board you could probably sample it often enough to get reasonable data, otherwise random bumps in the carpet will screw the whole thing up.

3) Dead reckoning is just too dang easy. 10 mins of coding, 5 mins of calibrating and you've got a almost flawless auto routine that is just as good as gyro. "But someone can ram you in auto mode and throw you off" I know, but my guess is you gyro teams would be thrown off just as easily (or possibly worse as a large jolt could confuse the whole system and resulting in your robot doing something very stupid).

My thoughts.
Greg
__________________
The above was my opinion. I'm wrong a lot. I'm sarcastic a lot. Try not to take me too seriously.
Reply With Quote
  #23   Spotlight this post!  
Unread 11-04-2003, 23:23
Caleb Fulton's Avatar
Caleb Fulton Caleb Fulton is offline
Z = Z^2 + C ......WHEEEE!
AKA: aXvXiA
#0461 (West Side Boiler Invasion)
Team Role: College Student
 
Join Date: Dec 2002
Location: West Lafayette, Indiana
Posts: 205
Caleb Fulton has a spectacular aura aboutCaleb Fulton has a spectacular aura aboutCaleb Fulton has a spectacular aura about
Send a message via AIM to Caleb Fulton
Many teams use external circuits because the BASIC stamp is too slow... Would they really say that it works if it doesn't?

My experience is that the more control the program has over what actually happens the better: dead reckoning, in the "DO THIS, DO THAT, STOP, DO THIS AGAIN" sense does not work with sensitive drive trains/batteries that change motor speeds/etc...
__________________
Reply With Quote
  #24   Spotlight this post!  
Unread 11-04-2003, 23:33
imjustmatthew's Avatar
imjustmatthew imjustmatthew is offline
Registered User
#0638 (Operation Oxidation)
 
Join Date: Jan 2003
Location: Richmond, VA
Posts: 19
imjustmatthew is an unknown quantity at this point
Send a message via AIM to imjustmatthew Send a message via Yahoo to imjustmatthew
We used it too

GregT is right, the Gyro without a custom board is a PAIN. Our core loop runs at about 33Hz and we got reasonably good data of the gyro (at least enough to work with). We simply "smoothed" the gyro data by averaging the last three values we recieved. However Greg is wrong that it doesn't help with dead reckoning, granted without some $@#$@#$@#$@#$@#$@#$@# stuff I don't know how to make our robot can't recover from an impact, we can tell the robot to stop, or shove hard, depending on where it is in operation. We originally had a second gyro, from last years kit, and VCU Regional didn't catch it, but apparently they cost more then $200 each and violate the rules. We were using the second one to detect pitch changes, so like other teams we could detect the spike associated with hitting the top of the ramp. This created a problem with our low sampling rate, until we noticed that the gyro is sensitive enough to get just a little "hang time" after it hits the top at full speed and we can use this to ensure we don't have a false reading. We also got the "Leadership in Control" Award, at VCU regional. Good Luck to all from 638, Operation Oxidation, of the Galileo Divison.
__________________
Matthew Roy

"We propose to decompose the competition."
Reply With Quote
  #25   Spotlight this post!  
Unread 11-04-2003, 23:56
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
I have to disagree with GregT

of course you cant turn your robot faster than the 75° per second limit of the gyro, and expect to get useful data out of it. Thats one reason we used a V turn instead of a 180° arc in auton mode, if you only need to turn 45° then a half second is not very long.

As for normal steering, you very seldom need to turn your bot faster than that, and if you do, have your closed loop steering selectable with an over-ride button. Having closed loop feedback steering makes the bot INCREDIBALLY more controllable - esp if you are trying to stack boxes, pick up a box...

and we also found it was very difficult to drive our bot up the ramp without closed loop steering - esp when we had two drive wheels and two castors - if you were half way up the ramp and one wheel started to slip a bit, by the time the driver corrected for it, the bot was going sideways

but when we close the loop with the gyro, the bot goes EXACTLY where you tell it to go, no matter WHAT!

as for integrating the signal in SW - 40 samples per second is not enough for you?! I dont understand your reasoning - any machine this heavy cannot change its rate of turn very quickly, certainly not 40 times a second - so the signal that is coming from the gyro is already 'averaged' by the inertia of the robots mass.

We did some playing around with the 'gyro compass' on our bot - we could set a limit so it would not turn past a certan angle in either direction - lets say 360°. You could start the bot out heading north, and spin it all the way around and when it hit 360° it would not turn any further - like it was hitting an invisable wall, then you could spin it all the way around the other way, and it would stop at 360 again - dead on - and you could do this for several minutes with no visable drift in the compass accuracy - it was really cool to play with.

If you were getting noise from the carpet in your signal while trying to use it for steering, then maybe you didnt have it mounted flat. If you mount the gyro angled, then it will respond to motion in two axis instead of the one you want.

I had also read that you need to add external filters and circuits and whatnot to make the gyro 'usable' - we didnt use any, and we had no problems at all. Our closed loop steering was very stable and useful, and our integrated 'compass' heading put our auton V turn dead on 45° every single time.
Reply With Quote
  #26   Spotlight this post!  
Unread 12-04-2003, 07:43
imjustmatthew's Avatar
imjustmatthew imjustmatthew is offline
Registered User
#0638 (Operation Oxidation)
 
Join Date: Jan 2003
Location: Richmond, VA
Posts: 19
imjustmatthew is an unknown quantity at this point
Send a message via AIM to imjustmatthew Send a message via Yahoo to imjustmatthew
Did you isolate the gyro?

KenWittlief, Did you isolate the gyro somehow to reduce vibrations, we had it firmly mounted on one axis and got occasional spikes in testing. we considered trying to isolate the gyro from bumps and golts with some kind of padding, but didn't. Did you guys, or anyone else try this?
__________________
Matthew Roy

"We propose to decompose the competition."
Reply With Quote
  #27   Spotlight this post!  
Unread 12-04-2003, 16:54
GregT GregT is offline
Registered User
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: FL
Posts: 400
GregT will become famous soon enough
Send a message via AIM to GregT
So you willingly slowed down your robot so you could use the gyro? Im just trying to say that it's not worth it. Sure it can probably be more accurate then dead reconing, but not more accurate enough to matter. To use it would have slowed down the time it took my team's robot to make it to the top (we can turn faster then the gyro's limit) so we dropped it from our autonomous design.

Its my opinion that the gyro is only useful when something unexpected happens. When something unexpected happens a gyro isn't usually enough to get you back on course. A gyro and a forward speed indicator of some sort would be a competely different sotry, but a gyro by itself is of limited usefulness.

Feel free to argue with me, these are just my opinions.

Greg
__________________
The above was my opinion. I'm wrong a lot. I'm sarcastic a lot. Try not to take me too seriously.
Reply With Quote
  #28   Spotlight this post!  
Unread 13-04-2003, 08:52
imjustmatthew's Avatar
imjustmatthew imjustmatthew is offline
Registered User
#0638 (Operation Oxidation)
 
Join Date: Jan 2003
Location: Richmond, VA
Posts: 19
imjustmatthew is an unknown quantity at this point
Send a message via AIM to imjustmatthew Send a message via Yahoo to imjustmatthew
We thought of trying to get a distance base of sorts to work off a drive shaft, using either a magnent or bump and limit switch, but could get it to work. I think that to really be able to recorrect with a gyro you would need a forward speed sensor of sorts, but It seems that any such sensor on the drive train would be subject to an extreme amount of stress from vibration and impacts; at least on our drive train .
__________________
Matthew Roy

"We propose to decompose the competition."
Reply With Quote
  #29   Spotlight this post!  
Unread 13-04-2003, 19:39
Jared Russell's Avatar
Jared Russell Jared Russell is online now
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,078
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
We integrate the outputs to get position as well. No need for a custom circuit IMO...the RC was able to get within a fraction of a degree each time.
Reply With Quote
  #30   Spotlight this post!  
Unread 13-04-2003, 19:49
Jonathanb's Avatar
Jonathanb Jonathanb is offline
1037 S.C.R.E.A.M-a-holic
#1037 (S.C.R.E.A.M Team)
Team Role: Driver
 
Join Date: Jan 2003
Location: Rochester Hills, Michigan
Posts: 73
Jonathanb is on a distinguished road
Send a message via AIM to Jonathanb
We used the gyro to make our robot drive straighter and turn smoother.
__________________
Jonathan
S.C.R.E.A.M 1037
www.teamfordfirst.org/team1037

2004 Detroit Website Design Award Winner
Reply With Quote
Reply


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
gyro code odin892 Programming 2 08-04-2003 14:50
Team 469 and the Gyro archiver 2001 0 24-06-2002 02:57
This Gyro is driving me crazy! archiver 2001 2 23-06-2002 23:35
Is any team using the gyro chip? Ragin_Kage Kit & Additional Hardware 4 10-04-2002 12:11
Have YOU used the gyro chip? FotoPlasma Technical Discussion 10 31-01-2002 13:26


All times are GMT -5. The time now is 15:02.

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