OCCRA
Go to Post However I did tell my wife I wanted to lose 20lbs of ugly fat quickly. She told me to cut off my head. Go figure. - Ed Coleman [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-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 01-01-2004, 06:31 PM
magical hands magical hands is offline
Jigar Patel
AKA: Jigar Patel
FRC #2185 (Etobicoke CI)
Team Role: Mentor
 
Join Date: Dec 2003
Rookie Year: 2004
Location: TORONTO
Posts: 93
magical hands is on a distinguished road
how can you use a gyro in autonomous mode

Hi! i just have a question since i am very new programmer. Okay i know how to create an autonomous mode but how can you use gyro's in autonomous mode. please show me a code so i can have a look at it and learn. thanks by the way my e-mail address is jigarjuhi@yahoo.ca. thanks guys for your time and co-operation.
  #2   Spotlight this post!  
Unread 01-02-2004, 12:18 AM
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Re: how can you use a gyro in autonomous mode

I shouldn't even be writing this, but i felt like i needed to. The second topic in this forum asks the exact same thing (found here:http://www.chiefdelphi.com/forums/sh...ad.php?t=23268) and i gave them the following response:

Quote:
Originally Posted by myself in another forum
one piece of advice, before bringing up something that is not completely obscure, search the forums and also just go the the appropriate forum and make sure to change the start date from one week to one year or something along those lines. here's one forum on gyroscopes and C and the like:
http://www.chiefdelphi.com/forums/sh...ad.php?t=23071
I cannot say it enough, search, search, search!

As i just realized though, that doesn't give autonomous code. All a gyro can really do is tell you which way you're pointing, nothing more. So there really is no way to give sample code except for the following which just integrates the gyro output to give you one number which shows how far you've turned.

Code:
int theta=0;  //in global variables

// from here on in autonomous section or what have you

signed char gyro = (GYRO-127)*G_ADJUST; //GYRO being the macro for wherever your gyro is attached
                                          //and G_ADJUST is a constant to adjust to degrees

if (theta+gyro>=360)  //rolling from 359 to 0 and around again
   theta+=gyro-360;
else if (theta+gryo<0)  //rolling from 0 to 359 and around again
   theta+=gyro+360;
else
   theta+=gyro;
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year

Last edited by Anthony Kesich : 01-02-2004 at 12:38 AM.
  #3   Spotlight this post!  
Unread 01-02-2004, 01:18 AM
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 785
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
Re: how can you use a gyro in autonomous mode

Quote:
Originally Posted by magical hands
Hi! i just have a question since i am very new programmer. Okay i know how to create an autonomous mode but how can you use gyro's in autonomous mode. please show me a code so i can have a look at it and learn. thanks by the way my e-mail address is jigarjuhi@yahoo.ca. thanks guys for your time and co-operation.
I cannot say enough that posting "I need code to use the gyro" or "I need autonomous code" is akin to saying "I need a design for an arm for my robot" in the mechanical forum. In order to get a useful answer you need to make your question more specific. What should the code do? Should the code simply read the value of the gyro and discard it while driving forward for 5 seconds? Should the code make sure the robot drives straight? Should the code drive straight ahead, turn 90 degrees, then drive straight ahead again? In engineering requirements are key. We cannot help you if we don't know what you need help with.

Mike
  #4   Spotlight this post!  
Unread 01-02-2004, 12:31 PM
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
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
Programming Autonomous mode Jared Stofflett Programming 3 11-11-2003 08:32 AM
autonomous mode problem on field Chris_C Programming 17 03-26-2003 06:11 PM
Autonomous mode AntmanIV General Forum 1 02-17-2003 12:30 PM
autonomous mode timer Don Programming 6 02-09-2003 09:16 PM
autonomous mode? bigwalt Technical Discussion 1 01-21-2003 12:14 AM


All times are GMT -5. The time now is 06:37 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi