|
Re: Control Shooter RPM with a Counter
I have a complete different Idea on how I would approach this type of thing, so I figure I will outline it for you briefly, and you can let me know if you would rather look into this.
I have in my code a similar thing, expect that we change our speed with joystick buttons. However, the only difference is (and it is a big one) is that I use the CAN Serial port option to send the RPM values and use an internal PID on my shooter Jaguar. CAN, until you get used to it, is very very hard to figure out on your own. I could do my best to give tips and tricks, but no matter what, it comes down to how badly you want it to work. It works wonderfully on our robot, and we were sinking 90% of our shots once we got our feeder to work, but the hardest part comes down to the pwm is a hardware setup (you just have to run cables) and the CAN is a hardware (you have to run cables) and a software (you have to preset your jaguars) setup.
Another note on it, it only works with Jaguars, so if you have Victors, it wont help.
Lastly, if you used this option, it would be entirely different and there would be no need for a counter. The code for it however is a lot more simpler than what I see you were doing.
It all comes down to preference. If you want to make the switch to CAN, I will do everything I can to help, but it is a lot of troubleshooting until you figure out how it all works. I made the switch for just our shooter wheel this year, and I started on January 8th, and didnt have it all figured out until February. And still now, all the other people dont fully understand it yet, so at our first competition in Rochester for the Finger Lakes Regional, the Jaguars were not properly set up and I had to spend half an hour setting up the Jaguars.
The switch to CAN from PWM is hard, but I have found it quite useful, especially for wiring, because if you have the right encoders, you can put them into your Jaguar, and the only cable going across your robot is your CAN bus line cable.
|