Go to Post If the left side of your brain controls the right side of your body then left handers are the only ones in "their right mind". - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Electrical
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 23-01-2017, 17:13
rtse's Avatar
rtse rtse is offline
449 Lead Programmer
AKA: Ryan Tse
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Mar 2016
Rookie Year: 2016
Location: Montgomery Blair High School
Posts: 9
rtse is an unknown quantity at this point
Minimum Flywheel Encoder CPR

My team was considering buying cheap 20 CPR encoders for our shooter, reasoning that the encoder on a high-speed flywheel can get away with having less resolution without hurting performance. All the other encoders we have worked with have had 4092 CPR (or 512 CPR on a quadrature), so 20 CPR encoders seemed kinda sketchy to me.

What is a good rule of thumb for minimum CPR for a flywheel of a specific maximum velocity?
__________________
Ryan Tse

2015-2016: 449 Programmer
2016-2017: 449 Lead Programmer

GitHub
rytse@mbhs.edu
Reply With Quote
  #2   Spotlight this post!  
Unread 23-01-2017, 17:18
gerthworm's Avatar
gerthworm gerthworm is offline
Making the 1's and 0's
FRC #1736 (Robot Casserole)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Peoria, IL
Posts: 80
gerthworm has a spectacular aura aboutgerthworm has a spectacular aura about
Re: Minimum Flywheel Encoder CPR

Assuming you're measuring off of the flywheel:

A single cycle per revolution on a slow flywheel would still get you at least 2000/60 = 33 cycles per second. This might be a bit low for a tight control loop, but you could definitely work with it.

I say this is ok because it means you get information on each edge of the encoder, so 66 times per second. This means the fastest it makes sense to fully evaluate your control algorithm more than ever 1/66th of a second (about 15ms or so, which is on par with most algorithms).

Now, in general, it's better to get a handful of samples and average them, but you could still get by without it in many cases....

So, basically any encoder. The worse limit is having a very high CPR, and generating frequencies beyond the sampling limits of the controller. Still, the RIO samples at 40MHz, so this would still be hard to violate.

Last edited by gerthworm : 23-01-2017 at 17:22.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-01-2017, 17:31
efoote868 efoote868 is offline
foote stepped in
AKA: E. Foote
FRC #0868
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2005
Location: Noblesville, IN
Posts: 1,427
efoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond repute
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by rtse View Post
My team was considering buying cheap 20 CPR encoders for our shooter, reasoning that the encoder on a high-speed flywheel can get away with having less resolution without hurting performance. All the other encoders we have worked with have had 4092 CPR (or 512 CPR on a quadrature), so 20 CPR encoders seemed kinda sketchy to me.

What is a good rule of thumb for minimum CPR for a flywheel of a specific maximum velocity?
If I recall correctly, in 2012 we had 1 count per revolution on our shooter wheel. The trick then becomes smoothing the counts with a low pass filter.

This year, you may want a little higher resolution (due to trying to shoot more balls per second), but I'd imagine 20 counts per revolution would work just fine.
__________________

Be Healthy. Never Stop Learning. Say It Like It Is. Own It. Like our values? Flexware Innovation is hiring!. We're looking for Senior Automation, Software, and System Engineers. Check us out!
Reply With Quote
  #4   Spotlight this post!  
Unread 23-01-2017, 17:49
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,135
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: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by efoote868 View Post
If I recall correctly, in 2012 we had 1 count per revolution on our shooter wheel. The trick then becomes smoothing the counts with a low pass filter.
Highly recommended if using a one-count-per-rev sensor: use the FPGA to measure the period between the last 2 counts. Do not filter that value, since it represents an entire revolution... and there is no issue with noise due to physical edge location since it's the same edge being measured each time.


Reply With Quote
  #5   Spotlight this post!  
Unread 23-01-2017, 19:34
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,761
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Minimum Flywheel Encoder CPR

Note that if you're planning on using the Talon SRX to run your control loop, it has a fixed definition of quadrature counts per 100ms as the velocity definition. And it actually runs the control loop at 1kHz. I'm not entirely certain how they bridge that gap, though.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #6   Spotlight this post!  
Unread 24-01-2017, 09:05
jojoguy10's Avatar
jojoguy10 jojoguy10 is online now
Programming/Controls Mentor
AKA: Joe Kelly
FRC #0997 (Spartan Robotics) and FRC #2990 (Hotwire Robotics)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Corvallis, OR
Posts: 298
jojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant future
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by Kevin Sevcik View Post
Note that if you're planning on using the Talon SRX to run your control loop, it has a fixed definition of quadrature counts per 100ms as the velocity definition. And it actually runs the control loop at 1kHz. I'm not entirely certain how they bridge that gap, though.
We're using the Armabot RS7 encoder (advertised "12 CPR") with the Talon SRX. In our Java code, we called the method "talon.setEncoderCodesPerRev" to be 1/4th of the CPR (so....3 ) in order for the velocity to be true (we tested with a tachometer. After you set that number, you can use "talon.set(rpm)" to have the motor run at that RPM without any other math.
__________________

2013 and 2014 - Student (FRC#2990), Programmer (LabVIEW)
2015 and 2016 - Mentor (FRC#2990), Programming (LabVIEW)
2017-Current - Mentor (FRC#997), Controls/Programming (Java)
2015-Current - A/V Volunteer at Oregon events
Reply With Quote
  #7   Spotlight this post!  
Unread 24-01-2017, 09:09
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,729
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by Ether View Post
Highly recommended if using a one-count-per-rev sensor: use the FPGA to measure the period between the last 2 counts. Do not filter that value, since it represents an entire revolution... and there is no issue with noise due to physical edge location since it's the same edge being measured each time.


This is what we are doing with great success.
Reply With Quote
  #8   Spotlight this post!  
Unread 24-01-2017, 09:11
Type's Avatar
Type Type is offline
Registered User
FRC #3452 (GreengineerZ)
Team Role: Mechanical
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Michigan
Posts: 196
Type is an unknown quantity at this point
Re: Minimum Flywheel Encoder CPR

Sorry to change the topic but has anybody used a SRX Mag Encoder on a flywheel?
__________________
3452- Lead Builder/ Pit Boss & Ambassador


*My posts do not reflect the opinion of my team*
Reply With Quote
  #9   Spotlight this post!  
Unread 24-01-2017, 09:16
jojoguy10's Avatar
jojoguy10 jojoguy10 is online now
Programming/Controls Mentor
AKA: Joe Kelly
FRC #0997 (Spartan Robotics) and FRC #2990 (Hotwire Robotics)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Corvallis, OR
Posts: 298
jojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant futurejojoguy10 has a brilliant future
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by Type View Post
Sorry to change the topic but has anybody used a SRX Mag Encoder on a flywheel?
The Talon SRX Software Reference Manual uses that for all of their examples (and the CTRE GitHub page too)
__________________

2013 and 2014 - Student (FRC#2990), Programmer (LabVIEW)
2015 and 2016 - Mentor (FRC#2990), Programming (LabVIEW)
2017-Current - Mentor (FRC#997), Controls/Programming (Java)
2015-Current - A/V Volunteer at Oregon events
Reply With Quote
  #10   Spotlight this post!  
Unread 24-01-2017, 14:43
Oblarg Oblarg is offline
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,116
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by Type View Post
Sorry to change the topic but has anybody used a SRX Mag Encoder on a flywheel?
We did, in our preseason project.

It worked just fine.
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
  #11   Spotlight this post!  
Unread 24-01-2017, 16:33
fovea1959's Avatar
fovea1959 fovea1959 is offline
Herder of programmers
AKA: Doug Wegscheid
FRC #3620 (The Average Joes)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: St Joseph
Posts: 336
fovea1959 will become famous soon enough
Re: Minimum Flywheel Encoder CPR

jojoguy: I'm having a hard time working through the math that gets me to "setting CPR to 3 let's me specify setpoint in RPM". Can you lead me through the math?

we're off for 3 night (exams!), so I can't fiddle with it in the lab.
Reply With Quote
  #12   Spotlight this post!  
Unread 24-01-2017, 16:35
Oblarg Oblarg is offline
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,116
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by fovea1959 View Post
jojoguy: I'm having a hard time working through the math that gets me to "setting CPR to 3 let's me specify setpoint in RPM". Can you lead me through the math?

we're off for 3 night (exams!), so I can't fiddle with it in the lab.
The talon SRX library completely changes its unit handling (for some functions, but not others!) if you specify your encoder CPR (or if you use an input device for which it knows the CPR, i.e. the CTRE mag encoder).

I, for one, think this is terrible design.
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
  #13   Spotlight this post!  
Unread 24-01-2017, 17:07
Oblarg Oblarg is offline
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,116
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by fovea1959 View Post
I know it changes, but I still can't arrive at CPR = 3 (instead of the CPR = 12) ends up with "I'm working in RPM". I'm trying to understand why that works...
It depends on whether the advertised CPR is cycles per revolution or edges per revolution - these differ by a factor of 4.

The config method wants the former, despite all the native units being calculated using the latter.

Yes, this is confusing and bad and should be changed
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
  #14   Spotlight this post!  
Unread 24-01-2017, 17:14
efoote868 efoote868 is offline
foote stepped in
AKA: E. Foote
FRC #0868
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2005
Location: Noblesville, IN
Posts: 1,427
efoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond repute
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by Ether View Post
Highly recommended if using a one-count-per-rev sensor: use the FPGA to measure the period between the last 2 counts. Do not filter that value, since it represents an entire revolution... and there is no issue with noise due to physical edge location since it's the same edge being measured each time.


That works.

We started the build season with a different encoder, and for a reason I can't recall, it got swapped. I'm remembering that the encoder was noisy, and needed to be debounced. The students didn't want to rewrite all of their code, so I gave them the band-aid. Our shooter wheel was very consistent that year, unfortunately the foam basket balls weren't.
__________________

Be Healthy. Never Stop Learning. Say It Like It Is. Own It. Like our values? Flexware Innovation is hiring!. We're looking for Senior Automation, Software, and System Engineers. Check us out!
Reply With Quote
  #15   Spotlight this post!  
Unread 24-01-2017, 17:23
fovea1959's Avatar
fovea1959 fovea1959 is offline
Herder of programmers
AKA: Doug Wegscheid
FRC #3620 (The Average Joes)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: St Joseph
Posts: 336
fovea1959 will become famous soon enough
Re: Minimum Flywheel Encoder CPR

Quote:
Originally Posted by Oblarg View Post
It depends on whether the advertised CPR is cycles per revolution or edges per revolution - these differ by a factor of 4.

The config method wants the former, despite all the native units being calculated using the latter.

Yes, this is confusing and bad and should be changed
Ah, now I *think* I understand. Once I say .ConfigEncoderCodesPerRev(3) [which is correct, 12 transitions per rev is 3 cycles or counts per rev), then the .set() method works in RPM.

If I don't call .ConfigEncoderCodesPerRev(), then .set() works in the silly transitions / 100ms units.

Do I have that correct?
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 12:35.

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