Go to Post 100% of the robots on Einstein in 2009 had hard plastic wheels for their drive train. - efoote868 [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
  #8   Spotlight this post!  
Unread 13-12-2003, 23:15
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
Re: Using Sensors

It's commented out because something didn't work right, but here's an example:


Code:
	'debug "Driving Forward!",cr
	
	'gyro_total = gyro_total + gyro_in
	'gyro_n = gyro_n + 1

	'if(gyro_n = gyro_sample) then
		
		
	'	buffer = gyro_total - (gyro_center * gyro_n)
	'	if(buffer > gyro_center) then
	'		left_target = FULLSPEED
	'		right_target = FULLSPEED - (buffer - gyro_center)
	'	endif
	'	if(buffer < gyro_center) then
	'		right_target = FULLSPEED		
	'		left_target = FULLSPEED - (buffer - gyro_center)
	'	endif
	'	if(buffer = gyro_center) then
	'		left_target = FULLSPEED
	'		right_target = FULLSPEED
	'	endif

'		'reset gyro vars
'		gyro_n = gyro_n + 1
'		gyro_total = gyro_total / gyro_n 'reset average for n=1
'	endif
The general idea was to take gyro_sample samples from the gyro, then use the average to see if the robot was heading straight or veering to one side. It would then correct by a constant * the difference between the desired and actual gyro readings (the constant is 1 in this code, that changed in later versions I can't seem to find anymore).

right_target and left_target are motor speeds, before being sent through a protective filter.

Keep in mind that this DIDNT WORK. I'm not sure why- I blamed it on the slow refresh of the RC, but it's much more likley due to my terrible programming

We ended up dropping the gyro entirely because it added complexity to a system that was working fine without it. I think that with some planning and the new RC strong programming teams could have a lot of fun with the gyro.

greg
__________________
The above was my opinion. I'm wrong a lot. I'm sarcastic a lot. Try not to take me too seriously.
 


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
Robotics Tournament at Sensors Expo & Conference Kyle Fenton Off-Season Events 4 04-05-2003 12:15
Q&A Discuss: Optical sensors with EduBot CD47-Bot Extra Discussion 2 01-03-2003 18:37
optical sensors acting strangely rosebud Electrical 10 03-02-2003 00:29
Robogui ! sensors don't work Fares Programming 2 07-01-2003 16:31
pre-built autonomous sensors? BandChick Technical Discussion 4 05-01-2003 22:06


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

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