DeepBlueRobotics / RobotCode2018

All of our code for FRC's 2018 game: FIRST Power Up.
5 stars 11 forks source link

PIDMove and PIDTurn should not finish until movement stops #63

Closed brettle closed 6 years ago

brettle commented 6 years ago

At the moment, these commands finish if onTarget() is true for just one cycle. However, this can happen while passing through the target value (i.e. overshooting). The result is that PID is disabled while still in motion and the final resting position/orientation can be significantly different that requested.

@Gabe-Mitnick suggests only letting isFinished() return true if we are onTarget() and the rate (e.g. ahrs.getRate() or encoder.getRate()) are sufficiently small.

brettle commented 6 years ago

PIDMove and PIDTurn should not finish until movement stops

doawelul commented 6 years ago

Done in latest commit. Implemented a maximum velocity for the commands to end (can be set to 0 if needed).

brettle commented 6 years ago

Fixed by 305b8e300c2088afe81d29d72316e05dc5348bc9.