Was wondering if it would be possible to measure and set shooter wheel rpm with a vex versa encoder?
Yes, it is possible. For measuring, you can divide encoder ticks/distance by time. For setting the speed, you can use a PID control loop to PID your motor speed based on feedback from your encoders.
From the specs on their website: (http://www.vexrobotics.com/276-2156.html)
The optical shaft encoder can detect up to 1,700 pulses per second, which corresponds to 18.9 revolutions per second and 1,133 rpm (revolutions per minute). Faster revolutions will therefore not be interpreted exactly, potentially resulting in erroneous positional data being passed to the microcontroller.
So the maximum speed of the shaft being measured is 1133 RPM. Assuming you are spinning something faster, you will have to change the rotation speed of the shaft you are measuring.
He may have been talking about the integrated vex versaplanetary stage with encoder from CTRE. I believe that can measure up to 15,000 rpm depending on the method you use (pwm or dio).
Ah, my mistake. If that’s the case, disregard my post.
We are using a wheeled shooter this year, and I am thinking to have a repeatable shot the wheels need to spin at same rate every time so was thinking using the versa planetary encoder to read and set rpm on the wheels
Yes, you do need a feedback mechanism to control the speed of the shooter wheel. Just always setting the motor value to “.75” or what have you, won’t work, as the actual speed will fluctuate.
To control the RPM, you can use a variety of methods. One method is Bang-Bang (what we used in 2012) and a whitepaper can be found here.
Another option is to create a PID loop that runs on the roboRIO.
Another option, at least in years past, was to feed the encoder values directly to a Jaguar, and the Jaguar would run the PID loop for you after you give it a set point. I am not sure what the equivalent motor controller of today is that can do that, however.
Another option would be for the speed to be controlled by a dial on the driver’s station. You could play with the dial as needed, even during the match, if you are having issues.
Even if you do not decide to use this method in competition, it might be a good way to figure out what speed you want in the first place and then use a Bang-Bang controller or PID loop to control on-field.
You still need a way to control and verify that what your dial is setting, is actually being run on the robot.
We did do something similar in 2012 though. After our camera tracked the target, and fed the shooter a setpoint value, we had 2 buttons on our joystick that would increase the RPM setpoint by 50, or decrease it by 50.
In the case that you are unable to create a speed control routine in code, you actually can do a reasonably good job just by accounting for the battery voltage.
The major contributor to speed fluctuations of your wheel will be battery voltage, assuming that your motor and mechanical system don’t change. By simply multiplying the amount your drive your shooter wheels by the % of battery voltage you can actually do a reasonably good job of keeping the motor at the same speed.
That said, if you use the “I” value in PiD, you can do a pretty good simple speed controller.
Yet another option would be TBH.
Another option, at least in years past, was to feed the encoder values directly to a Jaguar, and the Jaguar would run the PID loop for you after you give it a set point. I am not sure what the equivalent motor controller of today is that can do that, however.
Talon SRX has built-in PIDF (Proportional/Integral/Derivative/Feedforward) if used in CAN mode.
In case you do decide to use the velocity Closed-loop in Talon SRX, checkout section 12.4 for a Java walk-through of Velocity-closed-loop.
http://www.ctr-electronics.com/talon-srx.html#product_tabs_technical_resources
Also source here…
We are using srx speed controllers.
I should also include that we are using lab view
Then it might be worth trying out the SRX closed loop control; Should be simpler than implementing it yourself.
I am not versed with LabView, but I’m sure someone can help you with that.
I appreciate all the help. I am a mechanical mentor on the team. I can help/show these guys dream up and build about anything, but when it comes to the programming I am out of my wheelhouse.
Please keep the tips coming
Oh hey I almost forget, so there is a closed-loop speed example in LV for CAN Talon SRX.
Open LV,
Menu bar: Help => Find Examples…
Double clock on this tree node…
FRC Robotics => roboRIO => CAN =>CAN Talon Speed Control Encoder.lvproj
Example probably should be updated to select the CTRE Mag Encoder. Relative would be better since its just velocity (not position). Or just to quickly get started set the Encoder Codes Per Revolution to 1024 and leave Quadrature selected.
This example also does not take advantage of this year’s unit-scaling features in the API, so scaling to RPMis done manually, but again I think it will help get you going.