FTC7393 / FtcRobotController

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

Fetcher doesn't stop when you release the joystick #50

Closed robot256 closed 1 year ago

robot256 commented 1 year ago

When you release the fetcher joystick, the commands stops changing but the fetcher keeps trying to catch up with it. Additionally, when the fetcher 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 fetcherGoingToPreset, and set it true in fetcherToPreset and fetcherToValue.
  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 fetcherGoingToPreset 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

Code will (almost) function. I added some comments about formatting and variable placement.

robot256 commented 1 year ago

Tested working, good enough!