Go to Post I can tell you for a fact that students don't need smartphones in order to unproductively entertain themselves in a robotics lab. - remulasce [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 12-01-2010, 11:23
svenw svenw is offline
Registered User
FRC #3683
Team Role: Engineer
 
Join Date: Mar 2009
Rookie Year: 2006
Location: Waterloo
Posts: 34
svenw is a jewel in the roughsvenw is a jewel in the roughsvenw is a jewel in the rough
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 12-01-2010, 11:37
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,067
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
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.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #3   Spotlight this post!  
Unread 14-01-2010, 16:43
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
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.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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

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


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

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