![]() |
Question about encoders to control motor
Our team is competing this weekend at the Michigan State Championship, i have been the programmer for about the last two years and i look to improve our shooter. The way we control the speed of the shooter is working well but we look to improve it by adding an encoder. I have played around with encoders on an old robot i had played with them and understand how they work. Although i need help using the rpm from the encoder to control the shooter speed
I currently use Labview as a programming language What i am looking for is an example or VI that will automatically adjust the speed of the shooter to the desired rpm by using the information from the encoder. (if its going fast enough or to fast). I have looked at some of the PID Vi's but i cant seem to find one that will work for the application im looking for. If you can help me or give me an example how to use the encoder to control the shooter that would be great. Thanks |
Re: Question about encoders to control motor
I admire your passion for continuing to work on your code, but a word of caution is sometimes don't over-complicate things. I am directing you to this thread http://www.chiefdelphi.com/forums/sh...ight=Bang-bang to get started. It should get your feet off the ground. Know that your team has won two Michigan District Events so be careful when revamping code.
|
Re: Question about encoders to control motor
We use a bang-bang controller very successfully. It is very simple:
1) decide on the RPM you want for your shooter. Let's call it DesiredRPM. 2) You have the RPM from your encoder. Call it ActualRPM. 3) Implement your LabVIEW code as follows: if (ActualRPM < DesiredRPM) MotorOutput = 1.0; else MotorOutput = 0; The keys to this working well are: 1) Do NOT filter or use averaging of your RPM reading from your encoder. 2) Run it in the fast loop. We do it in a 30 ms loop and we get good results. If you have any questions or want any help with setting it up or testing, come find me in our pit on Wednesday evening. I won't be at the competition during the day on Thursday and Friday (I'll be at work). |
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
Quote:
- What model encoder are you using? - What motor(s) are you using? - What motor controller(s) are you using? - What is the gear ratio from your motor output shaft to the shooter wheel? - Where is you encoder mounted? (i.e. is it measuring the motor output shaft speed, or the wheel speed, or something in-between) - How are you decoding the raw signal from the encoder? (i.e. do you have it set up as a counter or an encoder, and are you reading counts or period) - What is your desired shooter wheel speed (aka "setpoint") Answering those questions will improve your chances of getting correct advice. |
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
We use bang-bang on our shooter wheel, and it's working pretty amazingly. But instead of an encoder, we have an optical sensor that is rigged as a digital signal, and set up as a Counter object in LabVIEW. We have the code running every 5 milliseconds in one of LabVIEW's timed loops. The motor speeds back up to our desired RPM very quickly after a dropoff, and there is only a little oscillation when it reaches the RPM (not enough to affect the shot, even at full court). And Gluxon, we haven't had any problems with our CIM or Jaguar, even running the algorithm at 200 Hz.
|
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
Quote:
It's not starting and stopping. It's starting and coasting. One of the requirements of using bang-bang is that the motor controller jumper must be in the "coast" position. Quote:
|
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
I'm not much help with Labview code specifically, but I can help you setup the control and explain the bang-bang controller to you a bit at MSC if you want some help. Just swing by our pit and ask for Joe.
|
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
Quote:
If your bang-bang controller is running fast enough and your sensor input is sufficiently noisy (enough to cause many on-off transitions), then the bang-bang control method is no different on the motor than running it by PWM. |
Re: Question about encoders to control motor
Quote:
|
Re: Question about encoders to control motor
Quote:
But there is a sense in which you're right. The input PWM period (for the Jag) is 5ms (200Hz). The output PWM frequency (for the Jag) is 15,000Hz. 15,000Hz is fast enough that the inductance of the motor (for a CIM anyway) smooths out the current so there's very little ripple. |
| All times are GMT -5. The time now is 22:55. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi