Go to Post Place a corner of it on the end of a table, clamp down the other side, and have a good whack at it with a hammer (hard). If it didn't break, it was polycarbonate. - vivek16 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-12-2013, 21:53
raptaconehs raptaconehs is offline
Registered User
FRC #3200
 
Join Date: Dec 2013
Location: Colorado
Posts: 54
raptaconehs will become famous soon enoughraptaconehs will become famous soon enough
Thumbs down 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.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-12-2013, 22:49
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Driving Straight with Encoders

Quote:
Originally Posted by raptaconehs View Post
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.


Reply With Quote
  #3   Spotlight this post!  
Unread 03-12-2013, 23:18
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
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.
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

Reply With Quote
  #4   Spotlight this post!  
Unread 05-12-2013, 13:42
raptaconehs raptaconehs is offline
Registered User
FRC #3200
 
Join Date: Dec 2013
Location: Colorado
Posts: 54
raptaconehs will become famous soon enoughraptaconehs will become famous soon enough
Re: Driving Straight with Encoders

Quote:
Originally Posted by Ether View Post
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 05-12-2013, 13:52
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Driving Straight with Encoders

Quote:
Originally Posted by raptaconehs View Post
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.


Reply With Quote
  #6   Spotlight this post!  
Unread 05-12-2013, 15:34
raptaconehs raptaconehs is offline
Registered User
FRC #3200
 
Join Date: Dec 2013
Location: Colorado
Posts: 54
raptaconehs will become famous soon enoughraptaconehs will become famous soon enough
Re: Driving Straight with Encoders

Quote:
Originally Posted by Ether View Post
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 05-12-2013, 15:36
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Driving Straight with Encoders

Quote:
Originally Posted by raptaconehs View Post
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?



Last edited by Ether : 05-12-2013 at 15:39.
Reply With Quote
  #8   Spotlight this post!  
Unread 05-12-2013, 16:18
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
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?
Reply With Quote
  #9   Spotlight this post!  
Unread 05-12-2013, 16:18
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Driving Straight with Encoders

Quote:
Originally Posted by raptaconehs View Post
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.
Reply With Quote
  #10   Spotlight this post!  
Unread 05-12-2013, 16:37
raptaconehs raptaconehs is offline
Registered User
FRC #3200
 
Join Date: Dec 2013
Location: Colorado
Posts: 54
raptaconehs will become famous soon enoughraptaconehs will become famous soon enough
Re: Driving Straight with Encoders

Quote:
Originally Posted by Ether View Post
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
Reply With Quote
  #11   Spotlight this post!  
Unread 05-12-2013, 16:38
raptaconehs raptaconehs is offline
Registered User
FRC #3200
 
Join Date: Dec 2013
Location: Colorado
Posts: 54
raptaconehs will become famous soon enoughraptaconehs will become famous soon enough
Re: Driving Straight with Encoders

Quote:
Originally Posted by Joe Ross View Post
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.
Reply With Quote
  #12   Spotlight this post!  
Unread 05-12-2013, 16:39
raptaconehs raptaconehs is offline
Registered User
FRC #3200
 
Join Date: Dec 2013
Location: Colorado
Posts: 54
raptaconehs will become famous soon enoughraptaconehs will become famous soon enough
Re: Driving Straight with Encoders

Quote:
Originally Posted by gpetilli View Post
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.
Reply With Quote
  #13   Spotlight this post!  
Unread 05-12-2013, 18:50
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Driving Straight with Encoders

Quote:
Originally Posted by raptaconehs View Post
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 View Post
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
Attached Thumbnails
Click image for larger version

Name:	beltTension.png
Views:	32
Size:	21.4 KB
ID:	15510  

Last edited by Ether : 05-12-2013 at 19:02.
Reply With Quote
  #14   Spotlight this post!  
Unread 06-12-2013, 13:02
raptaconehs raptaconehs is offline
Registered User
FRC #3200
 
Join Date: Dec 2013
Location: Colorado
Posts: 54
raptaconehs will become famous soon enoughraptaconehs will become famous soon enough
Re: Driving Straight with Encoders

Quote:
Originally Posted by Ether View Post
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.
Reply With Quote
  #15   Spotlight this post!  
Unread 06-12-2013, 13:05
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
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.
__________________
I code stuff.
Reply With Quote
Reply


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


All times are GMT -5. The time now is 13:02.

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