Go to Post "The secret to success is to acknowledge that you have limits, but to never acknowledge that you have reached those limits." - lady_raidan [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-01-2008, 18:44
eccmaster eccmaster is offline
Registered User
FRC #2344
 
Join Date: Jan 2008
Location: Yonkers
Posts: 17
eccmaster is an unknown quantity at this point
How to get robot to drive straigth using shaft encoders

Does any body know what is the best way to get the robot to drive straight using shaft encoders. We are using the same ones that are in the AndyMark super shifter, but they are on the tough box/ Thanks in advance
  #2   Spotlight this post!  
Unread 31-01-2008, 23:25
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: How to get robot to drive straigth using shaft encoders

I can't guarantee a "best" way to do it, but I can tell you a simple way. When you want to start going straight, set both the left and right encoder counts to zero. Every so often, perhaps in the Default_Routine() for convenience, read them both and compute the difference (or more likely the sum, as they will probably be counting in opposite directions). When the result is positive, tweak one side's motors to run a little slower and the other side a little faster than otherwise commanded. When the result is negative, do the opposite.
  #3   Spotlight this post!  
Unread 02-02-2008, 11:57
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: How to get robot to drive straigth using shaft encoders

As a suggestion....

We've tried encoders to drive straight and though it can be done. The EASIEST code to write and drive straight is using a GYRO. Our team's opinion so far in the past 4 years of working with sensors and trying different things.

I would upgrade to a 300 DPS (degree per second) gyro however, and NOT use the 80 DPS GRYO in the kit this year. You can pick up a 300 DPS gyro at sparkfun. The 2007 gyro works ok, it's a faster DPS than the 2008 gyro.

Just our experience. We've stablized a two wheel drive robot last year with a gyro. Carpet sliders on the front and back of bot with drive train in the middle.
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #4   Spotlight this post!  
Unread 02-02-2008, 21:04
eccmaster eccmaster is offline
Registered User
FRC #2344
 
Join Date: Jan 2008
Location: Yonkers
Posts: 17
eccmaster is an unknown quantity at this point
Re: How to get robot to drive straigth using shaft encoders

Hello
We did get the 300dps from spark fun to use for 90 degree turns. I did notice that when we use the gyro functions in easyC, instead of getting readings of 1/10th of a degree with the gyro that came in the kit of parts (90 degrees = 900) we got only steps of 1 degree (90 degrees = 90). Why is that so?
  #5   Spotlight this post!  
Unread 02-02-2008, 21:15
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: How to get robot to drive straigth using shaft encoders

Quote:
Originally Posted by eccmaster View Post
Hello
We did get the 300dps from spark fun to use for 90 degree turns. I did notice that when we use the gyro functions in easyC, instead of getting readings of 1/10th of a degree with the gyro that came in the kit of parts (90 degrees = 900) we got only steps of 1 degree (90 degrees = 90). Why is that so?
Did you change the GYRO type? When you intialize the gyro, you have to set the gyro type to scale it correctly.

Also, if you are using the gyro to drive straight, do not use the gyro easyC function (which returns DEGREES), instead, read the raw analog value from the gyro. This will be the "rate" of turn. If your not turning, the analog will be ZERO. If you start to turn, the gyro will sense the rate of your turn and you can use that as a error to adjust your PWM outputs.
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #6   Spotlight this post!  
Unread 02-02-2008, 23:50
intellec7's Avatar
intellec7 intellec7 is offline
108 programmer
AKA: Gustavo
FRC #0108 (SigmaC@ts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2006
Location: Hollywood, Florida
Posts: 65
intellec7 is on a distinguished road
Send a message via AIM to intellec7 Send a message via MSN to intellec7
Re: How to get robot to drive straigth using shaft encoders

The best way I know of driving straight with encoders to ensure that the wheels not only maintain in sync, but if they get out of sync , the robot returns back to it's original line is:

During an equal period take the difference between the encoder counts

Integrate this difference.

The result of the integration should be used to offset the commanded wheel commands. See the pseudo code below:

current_difference = left_count - right_count
integrated_error = integrated_error + current_difference

Left_Drive = Commanded_Left_Drive + integrated_error
Right_Drive = Commanded_Left_Drive - integrated_error

Let me know if I should make it clearer
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
Drive Straight C Code using Encoders without PID? Chris_Elston Programming 17 15-02-2005 23:41
Using Digi-Key Shaft Encoders D.Viddy Programming 45 02-01-2005 20:11
Using Shaft Encoders D.Viddy Programming 7 14-12-2004 18:27
Shaft Encoders wun Programming 3 12-10-2004 16:40
Where to get shaft encoders D.Viddy Programming 12 17-01-2003 09:38


All times are GMT -5. The time now is 19:07.

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