-
Notifications
You must be signed in to change notification settings - Fork 0
Elevator
Daniel-Marmo edited this page Jan 26, 2025
·
5 revisions
- Constructer: defines motor, encoder, and PID; sets encoderZeroed to false
- Up: changes setpoint by a positive incrementation from RobotMap
- Down: changes setpoint by a negative incrementation from RobotMap
- manualDown: changes speed to a negative value from RobotMap
- setSetpoint: changes the setpoint for the PID
- zeroEncoder: called at the beginning of autonomous once the elevator hits the lower switch, it resets the encoder and setpoint; after this is called PID is enabled
- reachedLowerLimit: checks to see if the elevator hit the bottom switch
- reachedUpperLimit: checks to see if the elevator hit the upper limit which is a value from RobotMap Periodic (Where PID setpoint and speeds are calculated and defined):
- First checks encoderZeroed value
- Once it is true, PID calculates the speed based on current position and setpoint
- Then checks to see if the elevator is at a limit and if it is moving in a direction that will pass the limit
- If it is the motor speed to 0
- If not it sets it to the calculated speed to get to the setpoint