![]() |
Driving Straight with Encoders
Hey guys. Team 3200 here. During the offseason we were doing some training. The bot that we built keeps drifting to the left by a severe amount. We have attached wheel encoders to try to even out this drift. We code using java and would really appreciate if you had any code examples to help get the bot to drive straight. Any help is much appreciated.
|
Re: Driving Straight with Encoders
Quote:
Describe your drivetrain and driver interface so we can make suggestions. |
Re: Driving Straight with Encoders
While you can use encoders to drive straight, a better idea might be to use a gyro since encoders can have errors due to wheels slipping. Regardless of the sensor you choose, you will want to use a PID controller to help correct the drift. When using encoders, one method would be to use a master-slave setup as described in this article. The example code is in ROBOTC, but the same principles apply. Basically you measure the speed difference between the two sides of the drivetrain and use that error with your PID controller to correct the drift.
Searching the forums will also provide you with more information on this topic, such as this thread. |
Re: Driving Straight with Encoders
Quote:
|
Re: Driving Straight with Encoders
Quote:
Four questions: What kind of wheels? Three suggestions: Put some extra weight over the rear wheels and see if that changes the amount of drift. Then move that extra weight to the front wheels and try again. |
Re: Driving Straight with Encoders
Quote:
|
Re: Driving Straight with Encoders
Quote:
Also, what diameter are the wheels? Quote:
|
Re: Driving Straight with Encoders
With the robot on blocks and no power applied, spin the wheels on both sides by hand. Do they have the same friction?
|
Re: Driving Straight with Encoders
Quote:
|
Re: Driving Straight with Encoders
Quote:
|
Re: Driving Straight with Encoders
Quote:
|
Re: Driving Straight with Encoders
Quote:
|
Re: Driving Straight with Encoders
1 Attachment(s)
Quote:
Have you tried putting it up on blocks and advancing the throttle slowly and observing the speed on each side? This is easy to do. Quote:
If you want to be a little more accurate, ask around to see if anyone on your team has a fish pull-scale. Hook the scale to the belt midway between the pulleys and pull1 it. Measure how far the belt deflects for a given force. 1see attachment |
Re: Driving Straight with Encoders
Quote:
|
Re: Driving Straight with Encoders
Although I agree that your issues are more likely mechanical, I have seen some robots that have drift problems that are not extremely severe (and thus difficult to properly diagnose), so there is some application for using encoders to even out drive. The basic technique is to use a feedback controller (eg. PID) to control the difference between the encoders. eg., if you're using (rightEnc-leftEnc), you'll control the value to 0 to move straight, some positive value to curve left, and some negative value to curve right.
|
| All times are GMT -5. The time now is 10:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi