FTC7393 / FtcRobotController

BSD 3-Clause Clear License
4 stars 1 forks source link

Lift keeps moving after you release joystick #51

Closed robot256 closed 1 year ago

robot256 commented 1 year ago

When you release the lift joystick, the commands stops changing but the lift keeps trying to catch up with it. Additionally, when the lift is on the way to a preset and the driver moves the joystick, it should abort the preset move and control from the current position.

Solution:

  1. Keep track of the previous joystick value.
  2. Make a state flag for liftGoingToPreset, and set it true in liftToPreset and liftToValue.
  3. When the joystick changes from positive to (zero or negative), OR from negative to (zero or positive), call stopExtension.
  4. When the joystick is not zero, if liftGoingToPreset is true, make it false and call stopExtension.
  5. After those checks are complete, regardless of the outcome, if joystick is not 0, call controlExtension.
robot256 commented 1 year ago

Not sure if this needs the wait-for-coasting feature of the fetcher. Probably not, since they only use the joystick occasionally.