This adds StopMotor() to the SpeedController interface for C++ and Java.

For Java, this is as simple as just adding it, as all motors already
have an implementation from MotorSafety that is correctly resolved. For
C++, I had to override StopMotor in the classes that descend from
SafePWM and explicitly call the SafePWM version. RobotDrive now calls
StopMotor on each of its SpeedControllers, instead of calling Disable or
setting the motor to 0.0 as it was doing previously.

Additional small formatting corrections to the previous commit starting
this were added.

Change-Id: Ie94565394927a910ce74bc628670ac3d658d8df9
This commit is contained in:
Fredric Silberberg
2016-02-10 14:00:06 -05:00
committed by Brad Miller (WPI)
parent 91c5db06db
commit 952ebb11ad
25 changed files with 215 additions and 35 deletions

View File

@@ -86,3 +86,8 @@ void VictorSP::Disable() { SetRaw(kPwmDisabled); }
* @param output Write out the PWM value as was found in the PIDController
*/
void VictorSP::PIDWrite(float output) { Set(output); }
/**
* Common interface to stop the motor until Set is called again.
*/
void VictorSP::StopMotor() { this->SafePWM::StopMotor(); }