Go to Post I guess we're going amish this year. - Jon Anderson [more]
Home
Go Back   Chief Delphi > Technical > Control System
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 08-07-2012, 05:08 PM
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,393
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Are we still using only 256 unique PWM steps?

Quote:
Originally Posted by Michael Hill View Post
The reason I mentioned that it would be nicer to have more resolution is well...put it this way. This year, the majority of teams (including 3138), had shooter wheels with a speed controller. If your max speed (that is full voltage to the motors/128 counts) is 4000 RPM, which is easily attainable, the finest you can change your motor speed by is ~30 RPM, which can be a heck of a difference. I'm sure there's got to be a way to use it as an unsigned value (that is 0-12V rather than -12-12V) to get 256 counts of resolution, but that would still only give you a 15 RPM resolution. While many teams figured out it didn't make a huge difference, it would be nice from a controls perspective to be able to control it down to a single RPM (which would be attainable with a 12-bit PWM signal)
You have the power to do this, with some custom software.

What you need is an output converter function (or sub-vi) that takes your desired 12-bit value and modulates the 8-bit PWM value. The modulation of the 8-bit PWM signal will increase your resolution. Here's an example of how to do it (get 12 bits from an 8-bit PWM):

1) Multiply the PWM output command (0.0 - 1.0 for your shooter motor that you should only command in one direction) by 127. You should end up with a PWM command with a whole part and a decimal part.

2) Take the decimal part and multiply by 16 and round to the nearest whole number. Call this number FractionalDuty. (Why 16? Because 12 bits has 16 time more resolution than 8 bits.)

3) Take the whole part of the number from step 1 and call it WholePWM.

3) In your fast loop, implement the following code:
Code:
if (counter < FractionalDuty)
   PWMOut = WholePWM + 1;
else
   PWMOut = WholePWM;

counter++;
if (counter >= 16)
   counter = 0;
Finally, convert back to 0.0 to 1.0 by dividing by 127.

What this does is it adds a one-count duty cycle on top of the PWM signal. It does it by increasing the 8-bit PWM by one count for a portion of every 16 timer loops. For example, if your FractionalDuty is 4, then it will increase the PWM output by one count for 4 out of the 16 loops. This averages your PWM output to be an additional 1/4 count. This will increase the resolution of your output, providing that your system time constant is much larger than the frequency of your added one-count duty cycle.

If you implement the above code in a 10 ms loop, you are modulating the PWM signal over a period of 160 ms. Most shooters this year spun up in about 2 seconds, giving them a time constant of about 500 ms. That makes the ratio of time constant to control cycle about 3/1, which isn't great, but it's not too bad. You might see your shooter speed oscillate by 5 RPM or so.

Note that the above code is to get the 12-bits that you want. If you go to 11-bits, you only need eight 10 ms loops to modulate your PWM. That gives your control cycle to time constant ratio of about 6:1, which is getting pretty good.


Disclaimer: I'm typing this while I'm being distracted by something, so my math might be off a bit.
__________________
-
An ounce of perception is worth a pound of obscure.

Last edited by Chris Hibner : 08-07-2012 at 10:27 PM.
Reply With Quote
  #17   Spotlight this post!  
Unread 08-08-2012, 06:36 AM
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 9,938
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Are we still using only 256 unique PWM steps?

What we had resorted to this year was to bump the speed on our flywheel-like shooter wheel to keep it in the range we needed for a specific shooting solution. The software people can discuss this in greater detail. When needed we added a little power to the wheel motors to keep it in the range. We used a simple encoder for wheel speed feedback. The first time I heard it running, I thought it was broken.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
All is better now, NOS parts are working fine. Why does this year's game remind me of Violet in Willie Wonka? Hmmmm, I see blueberries!
Reply With Quote
  #18   Spotlight this post!  
Unread 08-11-2012, 04:44 PM
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,113
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Are we still using only 256 unique PWM steps?

Quote:
Originally Posted by Michael Hill View Post
Ah, that makes a lot more sense. I was wondering how they would get by the 1.25 reference voltage of a LM317. I guess they COULD use LT3080s to get around that, but like I mentioned before, I haven't taken a Victor apart (mostly because they're not mine, and our team doesn't have the kind of resources to waste on me accidentally breaking a Victor).

The reason I mentioned that it would be nicer to have more resolution is well...put it this way. This year, the majority of teams (including 3138), had shooter wheels with a speed controller. If your max speed (that is full voltage to the motors/128 counts) is 4000 RPM, which is easily attainable, the finest you can change your motor speed by is ~30 RPM, which can be a heck of a difference. I'm sure there's got to be a way to use it as an unsigned value (that is 0-12V rather than -12-12V) to get 256 counts of resolution, but that would still only give you a 15 RPM resolution. While many teams figured out it didn't make a huge difference, it would be nice from a controls perspective to be able to control it down to a single RPM (which would be attainable with a 12-bit PWM signal)
Chris tackled how to get in-between PWM values by playing with the output signal.

To go a step further, you are stuck thinking in purely electrical terms here. You need to start thinking about the system you are controlling mechanically, which is what ether was getting at by pointing out control with bang-bang. More specifically you need to think about the inertia of the system.

You can send minute increases and decreases to the motors powering the wheels MUCH faster than the intertia of the wheel system will allow it to react. That means through the use of PID, or Bang-Bang, you can achieve much better resolution that your electrical system analysis would suggest, because the intertia of your mechanical system serves to damp or average the response.

In conversations with other teams that I trust, I heard of some managing to control as tightly as +/- 5 RPM. Our final value was about +/-13 rpm by the time I got sick of playing with encoders and Jaguars and gave up.

Being able to control it to a 'single' rpm in the way that you suggest wouldn't work very well. It would take a very long time for the inertia of the system to respond to a tiny increase in voltage so that you could actually get to that rpm.
__________________
Team 1718 Alpha Test Results
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 04:05 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi