Go to Post Add a little more grease if you aren't sure exactly how much you need. - MrForbes [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-07-2012, 20:49
KrazyCarl92's Avatar
KrazyCarl92 KrazyCarl92 is offline
Registered User
AKA: Carl Springli
FRC #5811 (The BONDS)(EWCP)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dayton, OH
Posts: 521
KrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond repute
Low Res Optical Encoders for Speed Control

This summer, Team 20 is revisiting a problem we experienced during the competition season. We had our shooter wheels powered by Banebots RS550s and on speed control with a 360 count encoder on each shaft connected to CAN jags. However, when our jaguars kept having brown-outs in CAN, we switched to PWM control, which meant we could not use the 360 count encoders for speed control at such high rpms (bye-bye shooting accuracy).

So now we are trying to resolve the CAN issues, but in the event that we cannot, we would like to have a back-up plan to get closed loop control with PWM. This would require a different sensor then we are currently using to measure rotation (we are currently using 360 count US Digital E4Ps).

Has anyone had experience with low-resolution optical encoders? And by low resolution I don't mean 64 or 100 counts per revolution, but more like single digits. I found this while searching on Digi-key:

http://www.digikey.com/product-detai...008S-ND/954400

, but I'm accustomed to using 4 pin connections with encoders (power, ground, A channel, B channel), and the ones I am finding all have 6 pins. The additional 2 pins have something to do with a switch according to the datasheets, but I have no clue how to work with that. Has anyone worked with something similar before or does anyone have other suggestions? The reason I'm interested in low-res optical encoders is because we know how to work with them, but I have seen teams with other solutions, so if there are other simple and effective ways to do the task we'd love to hear about those too.
__________________
[2017-present] FRC 0020 - The Rocketeers
[2016] FRC 5811 - BONDS Robotics
[2010-2015] FRC 0020 - The Rocketeers
  #2   Spotlight this post!  
Unread 12-07-2012, 20:56
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,105
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

Our team used a optical sensor with a 1ms response time, and had that going through a flywheel that had 3 holes. At 5000 rpms, that required about a 2ms response time, and it always worked. I know that other teams (341 in particular) used the retroreflective sensors from last years KOP, which worked as well.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
  #3   Spotlight this post!  
Unread 12-07-2012, 21:16
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: Low Res Optical Encoders for Speed Control

Quote:
Originally Posted by KrazyCarl92 View Post
PWM control ... meant we could not use the 360 count encoders for speed control at such high rpms
Why not?

If you put the 360 count encoders on the wheel shaft, that's 24000 counts per second at 4000 wheel rpm. The FPGA can handle 40,000 counts/sec

Use only one channel of the encoder and use the Counter class to trigger on rising edge only.



Last edited by Ether : 12-07-2012 at 21:20.
  #4   Spotlight this post!  
Unread 12-07-2012, 21:33
KrazyCarl92's Avatar
KrazyCarl92 KrazyCarl92 is offline
Registered User
AKA: Carl Springli
FRC #5811 (The BONDS)(EWCP)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dayton, OH
Posts: 521
KrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

Quote:
Originally Posted by Ether View Post
Why not?

If you put the 360 count encoders on the wheel shaft, that's 24000 counts per second at 4000 wheel rpm. The FPGA can handle 40,000 counts/sec


We have a 2 axle shooter, so if we had 2 axles reading that fast, could the FPGA handle it? I.E. would that then become 48,000 counts/sec? Also, are there other variables that could affect the FPGA and how it counts the encoders, and where can I read up to learn more about it?
__________________
[2017-present] FRC 0020 - The Rocketeers
[2016] FRC 5811 - BONDS Robotics
[2010-2015] FRC 0020 - The Rocketeers
  #5   Spotlight this post!  
Unread 12-07-2012, 21:47
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: Low Res Optical Encoders for Speed Control

Quote:
Originally Posted by KrazyCarl92 View Post
We have a 2 axle shooter, so if we had 2 axles reading that fast, could the FPGA handle it? I.E. would that then become 48,000 counts/sec?
I believe each FPGA input channel can handle 40,000 counts/sec. Perhaps someone with intimate knowledge of the FPGA could comment.

Quote:
Also, are there other variables that could affect the FPGA and how it counts the encoders, and where can I read up to learn more about it?
Download a copy of the WPILib C source code and read the descriptions of the methods in the Encoder and Counter classes.



Last edited by Ether : 12-07-2012 at 21:50.
  #6   Spotlight this post!  
Unread 12-07-2012, 22:20
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is offline
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,557
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: Low Res Optical Encoders for Speed Control

I know we were having issues with the 360 count encoder on our shooter but that may have just been our setup. We end up moving to a cheap IR reflective sensor and piece of white tape and it's worked perfectly.
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
  #7   Spotlight this post!  
Unread 12-07-2012, 22:26
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

Not that I'm an expert on the API or anything, but looking at the LV implementation, there are four 4x encoders and eight counters that can be used for 1x and 2x. As stated before, they are running on the FPGA and run in parallel along with each other, PWM generation, triggers, etc. So, the encoders will not be an issue.

Greg McKaskle
  #8   Spotlight this post!  
Unread 12-07-2012, 22:29
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,081
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

I think the actual number is 39,230.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

  #9   Spotlight this post!  
Unread 12-07-2012, 23:05
KrazyCarl92's Avatar
KrazyCarl92 KrazyCarl92 is offline
Registered User
AKA: Carl Springli
FRC #5811 (The BONDS)(EWCP)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dayton, OH
Posts: 521
KrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

Quote:
Originally Posted by Ether View Post

Use only one channel of the encoder and use the Counter class to trigger on rising edge only.


Our team uses Java. I'm not much of a programmer as it relates to the robot, but I have a bit of experience.

I notice that all of the constructors for Encoder objects require both an A channel and B channel as arguments, whereas the Counter constructors allow you to specify a single channel. Is this why we would use the Counter class to only count the rising edges? The Counter class doesn't have a getRate method, but would the getPeriod method return values that are useful for what we're trying to do?

And I noticed that 1x, 2x, and 4x counting are mentioned in the descriptions of many of the methods in the Encoder class. Is this something we need to consider when using the Counter class as well?
__________________
[2017-present] FRC 0020 - The Rocketeers
[2016] FRC 5811 - BONDS Robotics
[2010-2015] FRC 0020 - The Rocketeers
  #10   Spotlight this post!  
Unread 13-07-2012, 00:17
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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: Low Res Optical Encoders for Speed Control


You could use the getperiod method which returns the elapsed time between the two most recent edges, or you could read raw counts and divide the change in counts by the actual elapsed time since the counts were last read.

Each method has its pros and cons, and teams have been successful with both methods.

One or the other might be more appropriate depending on your encoder speed and the control algorithm you plan to use.


  #11   Spotlight this post!  
Unread 13-07-2012, 00:44
jspatz1's Avatar
jspatz1 jspatz1 is offline
Registered User
AKA: Jeff
FRC #1986 (Team Titanium)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Lee's Summit, MO
Posts: 836
jspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond reputejspatz1 has a reputation beyond repute
Send a message via AIM to jspatz1
Re: Low Res Optical Encoders for Speed Control

We also had trouble with the 360 res quad. US Digital trying to control up to 1500 rpm with pwm. We switched to 100 res single channel, at it worked great.
__________________
  #12   Spotlight this post!  
Unread 13-07-2012, 00:55
Ekcrbe's Avatar
Ekcrbe Ekcrbe is offline
When can I watch Einstein again?
AKA: Erik Boyle
FRC #4640 (Metallic Panthers)
Team Role: College Student
 
Join Date: Jan 2012
Rookie Year: 2012
Location: New York, NY
Posts: 333
Ekcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond reputeEkcrbe has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

I'm not the one to go to for technical answers, but this year, we actually put our encoder on a gear reduction from the shooter so it wasn't running as fast as the shooter, and then compensated accordingly in the calculations.

My 2 hillbilly pennies.
__________________
Four years of FRC 68 Truck Town Thunder
2012 Championship Newton Division Finalists—Thanks 330 and 639 for the Full Court Press!
2013 Kettering University District Chairman's Award Winners!
2014 Great Lakes Bay Region District Winners—Thanks 288, 4819, and 5166! | 2014 Waterford District Chairman's Award Winners! | 2014 Michigan FRC State Championship Chairman's Award Winners—Congratulations 33 and 503!
2015 Center Line District Chairman's Award Winners! | 2015 Lansing District Winners—Thanks 314 and 1684! | 2015 FIRST in Michigan District Championship Chairman's Award Winners—Congratulations 503 and 2137!


  #13   Spotlight this post!  
Unread 13-07-2012, 01:09
R.C.'s Avatar
R.C. R.C. is online now
2017... Oooh Kill em, Swerve!
AKA: Owner, WestCoast Products
FRC #1323 (MadTown Robotics)
Team Role: Engineer
 
Join Date: Feb 2008
Rookie Year: 2006
Location: Madera, CA
Posts: 2,184
R.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

We are using a 360 count s4 encoder from US Digital, we basically use the same PID loop with feed forward that 341 does.

We were getting our shooter +- 25 rpms pretty easily.

-RC
__________________
R.C.
Owner, WestCoast Products || Twitter
MadTown Robotics Team 1323

Last edited by R.C. : 13-07-2012 at 02:21.
  #14   Spotlight this post!  
Unread 13-07-2012, 02:15
BornaE's Avatar
BornaE BornaE is offline
Registered User
FRC #0842 (Formerly 39)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Gilbert, Arizona
Posts: 359
BornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant future
Re: Low Res Optical Encoders for Speed Control

While helping team 842 this year, we found that there are issues with using the 360 counts/rev encoders at the speeds we needed. never got around to actually debug what the issue was. They were using about 6/7 feet of wire routed next to motor wires and that may have been an issue. the reading were erratic changing by a a magnitude of 2 when they were graphed.

To resolve this, we removed the plastic disc from the encoder wheel and replaced it with piece of electrical tape on the disk so we had 1 rising and 1 falling edge. We were able to run the control system to achieve the desired RPM using the modified encoders.

Quote:
Originally Posted by Ether View Post
Why not?

If you put the 360 count encoders on the wheel shaft, that's 24000 counts per second at 4000 wheel rpm. The FPGA can handle 40,000 counts/sec

Use only one channel of the encoder and use the Counter class to trigger on rising edge only.


__________________
-Borna Emami
Team 0x27
  #15   Spotlight this post!  
Unread 13-07-2012, 08:05
KrazyCarl92's Avatar
KrazyCarl92 KrazyCarl92 is offline
Registered User
AKA: Carl Springli
FRC #5811 (The BONDS)(EWCP)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dayton, OH
Posts: 521
KrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond reputeKrazyCarl92 has a reputation beyond repute
Re: Low Res Optical Encoders for Speed Control

Quote:
Originally Posted by BornaE View Post
To resolve this, we removed the plastic disc from the encoder wheel and replaced it with piece of electrical tape on the disk so we had 1 rising and 1 falling edge. We were able to run the control system to achieve the desired RPM using the modified encoders.
This is the sort of workaround I'm interested in if we can't do it with a 360 count disc. The only thing that would usually concern me about this approach is a layer of tape (which if I remember correctly is thicker than the plastic disc) could change the tolerance on the encoder for the distance from the sensor to the disc. Was this even an issue, or could it be easily resolved if it does present a problem?
__________________
[2017-present] FRC 0020 - The Rocketeers
[2016] FRC 5811 - BONDS Robotics
[2010-2015] FRC 0020 - The Rocketeers
Closed Thread


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 04:38.

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