View Single Post
  #4   Spotlight this post!  
Unread 02-01-2004, 13:31
GregTheGreat's Avatar
GregTheGreat GregTheGreat is offline
Registered User
no team
 
Join Date: Jan 2003
Rookie Year: 2002
Location: USA
Posts: 386
GregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura aboutGregTheGreat has a spectacular aura about
Re: how can you use a gyro in autonomous mode

I know what the best bennifit of a gyro is (in my mind)... I consider it a backup device... using it with your counter you can make a very sound auton. program. I am searching through my programs last year to find an example of what I am talking about but my programs are on my old computer so when I backed them up on CD's they got thrown all over the place.

Basically it would work like this....

you could use a go-sub like this
Code:
 

	Gyrocounter:

	if sensor1 > 130 then Gyro1:             'Gyro Sensor Clockwise

        if sensor1 < 128 then Gyro2:             'Gyro Sensor Counterclockwise

	Goto Gyro3:

	Gyro1:
    
	cont = cont + sensor1 - 129 

	Goto Gyro3:

	Gyro2:
    
	cont = cont + sensor1 - 129        
    
	Gyro3:

	Pass:

	Return
Then incorperate your code like this....

Code:
         Right_Gyro:

	gosub gyrocounter

	if cont < 32000 then 

	relay1_fwd = 1 		'Two Wheel Drive On

	relay1_rev = 0 		'Four Wheel Drive Off
                
	endif	

        On indc goto RGyro, RGyro1, RGyro2, RGyro3, RGyro4

	RGyro:			'Half Circle

	p1_y = 175		'Right Front Wheel Forward

	p2_x = 175		'Right Rear Wheel Forward

	p2_y = 250		'Left Front Wheel Forward

        p3_x = 250		'Left Rear Wheel Forward

	If cont > 37800 then RGyro1

	Goto Main:

	RGyro1:			'Half Circle

	indc = 1

	relay1_fwd = 0 		'Two Wheel Drive Off

	relay1_rev = 1 		'Four Wheel Drive On
	
	p1_y = 175		'Right Front Wheel Forward

	p2_x = 175		'Right Rear Wheel Forward

	p2_y = 250		'Left Front Wheel Forward

        p3_x = 250		'Left Rear Wheel Forward

	If cont > 38200 then cycle = 0
	
	If cont > 38200 then goto RGyro2

	Goto Main:

	RGyro2:			'Straight Forward

	indc = 2

	p1_y = 253		'Right Front Wheel Forward

	p2_x = 253		'Right Rear Wheel Forward

	p2_y = 253		'Left Front Wheel Forward

	p3_x = 253		'Left Rear Wheel Forward
	
	If cycle >= 130 then RGyro3

	Goto Main:

	RGyro3:

	indc = 3

	p1_y = 127		'Right Front Wheel Stop

	p2_x = 127		'Right Rear Wheel Stop

	p2_y = 127		'Left Front Wheel Stop

	p3_x = 127		'Left Rear Wheel Stop

	If cycle >= 140 then RGyro4
You can get the basic idea on how to program a gyro (id the variabales)

REMEMBER
This is pbasic coding you will need to convert it into C for this years controller... on Innovation they have the "pamphlet" they created to show you how to do many of these functions... I will work on making some C programming for a gyro but I have many other things to work on for my team so I do not know how productive I will be...

If you need help with the coding give me something to work with... a general idea is hard to show you what you want but if you give me a very spacific idea I would be more than happy to help you out ne way I can.

If you need the help contact me...
AOL IM- GregTheGreat04 (no spaces)
E-mail- g.ullstam@comcast.net

Good Luck,

-Greg The Great