chopshop-166 / frc-2023

FRC Team 166's source code for the 2023 game, Charged Up
MIT License
2 stars 0 forks source link

Don't crash into floor #23

Closed Finn6360 closed 1 year ago

Finn6360 commented 1 year ago

Makes it not crash into floor.

msoucy commented 1 year ago

Since the encoders get zeroed on startup, the safest thing to do would be to have the encoder get reset when the arm is fully extended or retracted. When the current in the motor is way too high and the speed is negative, then it's probably trying to retract but it's all the way retracted. In that case, set the encoder value to 0. When the current in the motor is way too high and the speed is positive, then it's probably trying to extend but it's all the way extended. In that case, set the encoder to MAX_EXTENDED value.

TimnJoey commented 1 year ago

I believe I did what you wanted Matt. We had the retract stopper and Ben said we probably don't need the extend stopper. I did, however, add hard limits.