Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Driving Straight with Encoders (http://www.chiefdelphi.com/forums/showthread.php?t=122720)

raptaconehs 03-12-2013 21:53

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.

Ether 03-12-2013 22:49

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by raptaconehs (Post 1308350)
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.

Don't put lipstick on a pig. With severe drift, you should rule out alignment, excessive friction, and other mechanical, electrical, and software problems first.

Describe your drivetrain and driver interface so we can make suggestions.



Domenic Rodriguez 03-12-2013 23:18

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.

raptaconehs 05-12-2013 13:42

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by Ether (Post 1308365)
Don't put lipstick on a pig. With severe drift, you should rule out alignment, excessive friction, and other mechanical, electrical, and software problems first.

Describe your drivetrain and driver interface so we can make suggestions.



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.

Ether 05-12-2013 13:52

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by raptaconehs (Post 1308884)
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.


Four questions:
What kind of wheels?

How much are the center wheels dropped?

Chains or belts? How are you doing the tensioning?

What's the total speed reduction from motor to wheel (include gears, sprockets, and pulleys?

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.

Put the bot up on blocks and slowly advance the throttle and observe the left and right wheel speeds.



raptaconehs 05-12-2013 15:34

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by Ether (Post 1308887)
Four questions:
What kind of wheels?

How much are the center wheels dropped?

Chains or belts? How are you doing the tensioning?

What's the total speed reduction from motor to wheel (include gears, sprockets, and pulleys?
[/indent]


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.

Ether 05-12-2013 15:36

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by raptaconehs (Post 1308918)
Sorry but I don't know how to answer the last question because we are not sure how to measure that value.

What is the gear ratio of your gearbox, and what are the diameters of the driving and driven pulleys?

Also, what diameter are the wheels?

Quote:

We don't have any tensioners on the bot
Have you measured the belt tension?



Joe Ross 05-12-2013 16:18

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?

gpetilli 05-12-2013 16:18

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by raptaconehs (Post 1308884)
With toughbox minis which are specially made with a unique gear ratio for speed.

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.

raptaconehs 05-12-2013 16:37

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by Ether (Post 1308921)
What is the gear ratio of your gearbox, and what are the diameters of the driving and driven pulleys?

Also, what diameter are the wheels?



Have you measured the belt tension?



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

raptaconehs 05-12-2013 16:38

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by Joe Ross (Post 1308933)
With the robot on blocks and no power applied, spin the wheels on both sides by hand. Do they have the same friction?

We have tried this and it appears that the right side spins much easier than the left side.

raptaconehs 05-12-2013 16:39

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by gpetilli (Post 1308935)
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.

That is a possibility but because we will be using this bot on Saturday for an offseason event we are not able take of the gear boxes and see if they are geared identically.

Ether 05-12-2013 18:50

Re: Driving Straight with Encoders
 
1 Attachment(s)
Quote:

Originally Posted by raptaconehs (Post 1308947)
We have tried this and it appears that the right side spins much easier than the left side.

That could be the cause of your left-drift problem.

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:

Originally Posted by raptaconehs (Post 1308946)
We aren't sure how to measure belt tension

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

raptaconehs 06-12-2013 13:02

Re: Driving Straight with Encoders
 
Quote:

Originally Posted by Ether (Post 1309006)
That could be the cause of your left-drift problem.

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

Yea the left side goes slower than the right side. The belt tension is tighter on the left side. We used to have the right motors hooked up to the victors on the right and the left motors hooked up to the victors on the left. We switched the hook up so the right motors were hooked up to the victors on the left and the left motors are hooked up to the victors on right. The bot still curves to the left by a bit but it isn't as drastic as it was before.

Ginto8 06-12-2013 13:05

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