|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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.
|
|
#2
|
||||
|
||||
|
Re: Driving Straight with Encoders
Quote:
Describe your drivetrain and driver interface so we can make suggestions. |
|
#3
|
||||
|
||||
|
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. |
|
#4
|
|||
|
|||
|
Re: Driving Straight with Encoders
We use a 6 wheel drivetrain. With toughbox minis which are specially made with a unique gear ratio for speed. We use 2 CIMs on each toughbox. We use the standard drive code given by FIRST. We have been trying to check out mechanical and electrical problems but we haven't narrowed it down to anything yet.
|
|
#5
|
||||
|
||||
|
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. |
|
#6
|
|||
|
|||
|
Re: Driving Straight with Encoders
We use high grip traction wheels. The wheels are dropped about a quarter of an inch. We are using belts. We don't have any tensioners on the bot. Sorry but I don't know how to answer the last question because we are not sure how to measure that value.
|
|
#7
|
||||
|
||||
|
Re: Driving Straight with Encoders
Quote:
Also, what diameter are the wheels? Quote:
Last edited by Ether : 05-12-2013 at 15:39. |
|
#8
|
||||||
|
||||||
|
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?
|
|
#9
|
|||
|
|||
|
Re: Driving Straight with Encoders
Are you certain both toughboxes were updated identically? Since you intended to go faster, take the slower one (left) apart and make sure it has all the right gears. What gears (how many teeth) are you expecting to find? Two years ago, the person who rebuilt our TB put the middle 14T back when it needed to be changed to a 16T.
|
|
#10
|
|||
|
|||
|
Re: Driving Straight with Encoders
My manufacturing leader isn't sure of the gear ratio on the gear box. The diameter of the driving pulley is 2.75 inches. The diameter of the driven pulleys are 3 inches. The diameter of the wheels are 6 inches. We aren't sure how to measure belt tension
|
|
#11
|
|||
|
|||
|
Re: Driving Straight with Encoders
We have tried this and it appears that the right side spins much easier than the left side.
|
|
#12
|
|||
|
|||
|
Re: Driving Straight with Encoders
Quote:
|
|
#13
|
||||
|
||||
|
Re: Driving Straight with Encoders
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. OK, but can you tell if the belt on the left side is tighter than the belt on the right side? Push1 on the belt midway between the two pulleys and see how much it deflects. The tighter the belt is, the less it will deflect. 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 Last edited by Ether : 05-12-2013 at 19:02. |
|
#14
|
|||
|
|||
|
Re: Driving Straight with Encoders
Quote:
|
|
#15
|
||||
|
||||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|