|
Re: Run a series of instructions when button is pressed
Putting a loop in teleop is usually the least optimal solution. It will drain processing speed, and likely cause lag.
The way that we programmed our shooter this year used the wheel RPM as an indicator for if a frisbee was shot. If the RPM suddenly dropped, then a frisbee was launched.
Another way we programmed it was using a timing VI, which would send a boolean based on the elapsed time. That timer can be kept in teleop without slowing down the program.
We got the fastest and most consistent shooting using the first method, paired with RPM monitoring in periodic tasks. The RPM sensor would write to an array, and the last 25 numbers in the array were sampled and tested to see if they were within 3% of one another. When the wheel speed leveled off,
we would send a true global variable to teleop, which would send the solenoid forward. When the RPM dropped from the disk leaving, that would change the variable to false, and the solenoid would retract.
__________________
2012 FLR Regional Champs, with 1507 and 191
|