[wpilib] MotorControllerGroup: Override setVoltage (#4403)

This causes setVoltage to be called on the lower level motor contollers,
which is benefical in cases when they are smart motor controllers.
Previously, the default implementation (using the bus voltage and
calling set()) was used in this case.

This does slightly pessimize the case when the lower level motor
controllers use the default setVoltage implementation, but given the
prevalence of smart motor controllers, this seems like an overall win.
This commit is contained in:
Peter Johnson
2022-09-06 08:18:33 -07:00
committed by GitHub
parent f36162fddc
commit 65c8fbd452
3 changed files with 14 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ class MotorControllerGroup : public wpi::Sendable,
MotorControllerGroup& operator=(MotorControllerGroup&&) = default;
void Set(double speed) override;
void SetVoltage(units::volt_t output) override;
double Get() const override;
void SetInverted(bool isInverted) override;
bool GetInverted() const override;