|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using Encoders
So my team(781) wants to use encoders because one of our motors spins forward while the other spins backward to move our robot forward. Snce the motors do not spin the same speed with the same amount of energy we must use encoders. However we have no experience with this. Can you help us program and initialize the encoder?
Thanks, Team 781 Last edited by svenw : 12-01-2010 at 11:28. |
|
#2
|
||||
|
||||
|
Re: Using Encoders
Well, you don't *have* to use encoders. If all you were concerned about was that they were spinning the same rate, just figure out how much faster the other motor can spin, then scale the input to the motor appropriately (using the assumption that the motor response AND the output from the motor controller is linear).
Of course, thats a really quick and dirty approximation, and makes a lot of assumptions. If you want them to be matched using encoders, then you probably want to look into using PID control for this problem. Do a search on the forums, there's lots of stuff about that type of thing there. |
|
#3
|
|||
|
|||
|
Re: Using Encoders
Check out the Encoder class and associated documentation. You connect the A and B channels to digital inputs and supply the port numbers to the Encoder constructor. From there you can read the counts or rate.
You can also connect it to a PID object to control direction. For driving straight you can use something like the right-left encoder value. As one side gets ahead the value will swing either positive or negative and the PID class can apply the necessary correction to the turn rate. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using more than 4 encoders | stuartd | Programming | 3 | 10-03-2009 00:47 |
| [FTC]: Progress report on using encoders | PhilBot | FIRST Tech Challenge | 11 | 14-11-2008 14:01 |
| Autonomous using encoders | Mr.G | Programming | 11 | 17-01-2006 03:34 |
| 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 |