Open nicojopr opened 4 years ago
Specifically, use the CTRE Talon SRX API to tell the Talon to manage the limit switch and reset the encoder value when the limit switch is set. Ensure this works when the robot is disabled.
NOTE: I pulled out the breaker for the lift Talon on Mergonaut to prevent damage while everyone was experimenting with code. You can get a breaker back from Controls to re-activate the lift motor, but be careful while experimenting. It is OK to accidentally drive the motor "below zero" because the winch rope will just unspool. However, if you keep that up, it will eventually respool the winch in the other direction and start lifting the elevator again. DO NOT drive the elevator past its upper limit or YOU WILL BREAK THE ELEVATOR.
Now that the dramatic warning is out of the way:
Steps to test:
Set up some robot code to initialize the lift Talon to use the encoder connected to it. Set up the Talon to use the limit switch to prevent downward movement. Set up the Talon to use the limit switch to reset the encoder value. Set up the encoder value to display on Shuffleboard.
Now while the robot is disabled, manually turn the winch (with your hands). See that the encoder value increases to a non-zero value. Press the limit switch. Verify whether the encoder value goes back to 0.
Want: set the limit switch to 0 while the robot is disabled as prep for the match. This task is investigative to see if this can be done while the robot is disabled and if so, develop the production code to handle this at match start. Contact: Controls team Gabby
Production software including: