[wpilib] Rename MotorController setDutyCycle() to setThrottle() (#8720)

Fixes #8716.
This commit is contained in:
Tyler Veness
2026-04-09 22:28:01 -07:00
committed by GitHub
parent a4e035ba64
commit b6849a8da3
160 changed files with 659 additions and 706 deletions

View File

@@ -2,7 +2,7 @@ classes:
wpi::ExpansionHubMotor:
methods:
ExpansionHubMotor:
SetDutyCycle:
SetThrottle:
SetVoltage:
SetPositionSetpoint:
SetVelocitySetpoint:

View File

@@ -1,9 +1,9 @@
classes:
wpi::MotorController:
methods:
SetDutyCycle:
SetThrottle:
SetVoltage:
GetDutyCycle:
GetThrottle:
SetInverted:
GetInverted:
Disable:

View File

@@ -33,9 +33,9 @@ classes:
param_override:
args:
ignore: true
SetDutyCycle:
SetThrottle:
SetVoltage:
GetDutyCycle:
GetThrottle:
SetInverted:
GetInverted:
Disable:

View File

@@ -8,8 +8,8 @@ classes:
attributes:
m_pwm:
methods:
SetDutyCycle:
GetDutyCycle:
SetThrottle:
GetThrottle:
GetVoltage:
SetInverted:
GetInverted:

View File

@@ -5,4 +5,4 @@ classes:
overloads:
const PWMMotorController&:
int:
GetDutyCycle:
GetThrottle:

View File

@@ -17,9 +17,9 @@ void PyMotorControllerGroup::Initialize() {
wpi::util::SendableRegistry::Add(this, "MotorControllerGroup", instances);
}
void PyMotorControllerGroup::SetDutyCycle(double dutyCycle) {
void PyMotorControllerGroup::SetThrottle(double throttle) {
for (auto motorController : m_motorControllers) {
motorController->SetDutyCycle(m_isInverted ? -dutyCycle : dutyCycle);
motorController->SetThrottle(m_isInverted ? -throttle : throttle);
}
}
@@ -29,9 +29,9 @@ void PyMotorControllerGroup::SetVoltage(wpi::units::volt_t voltage) {
}
}
double PyMotorControllerGroup::GetDutyCycle() const {
double PyMotorControllerGroup::GetThrottle() const {
if (!m_motorControllers.empty()) {
return m_motorControllers.front()->GetDutyCycle() * (m_isInverted ? -1 : 1);
return m_motorControllers.front()->GetThrottle() * (m_isInverted ? -1 : 1);
}
return 0.0;
}
@@ -51,6 +51,6 @@ void PyMotorControllerGroup::Disable() {
void PyMotorControllerGroup::InitSendable(wpi::util::SendableBuilder& builder) {
builder.SetSmartDashboardType("Motor Controller");
builder.SetActuator(true);
builder.AddDoubleProperty("Value", [=, this]() { return GetDutyCycle(); },
[=, this](double value) { SetDutyCycle(value); });
builder.AddDoubleProperty("Value", [=, this]() { return GetThrottle(); },
[=, this](double value) { SetThrottle(value); });
}

View File

@@ -26,9 +26,9 @@ class PyMotorControllerGroup : public wpi::util::Sendable,
PyMotorControllerGroup(PyMotorControllerGroup&&) = default;
PyMotorControllerGroup& operator=(PyMotorControllerGroup&&) = default;
void SetDutyCycle(double dutyCycle) override;
void SetThrottle(double throttle) override;
void SetVoltage(wpi::units::volt_t voltage) override;
double GetDutyCycle() const override;
double GetThrottle() const override;
void SetInverted(bool isInverted) override;
bool GetInverted() const override;
void Disable() override;