mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpilib] Rename MotorController setDutyCycle() to setThrottle() (#8720)
Fixes #8716.
This commit is contained in:
@@ -2,7 +2,7 @@ classes:
|
||||
wpi::ExpansionHubMotor:
|
||||
methods:
|
||||
ExpansionHubMotor:
|
||||
SetDutyCycle:
|
||||
SetThrottle:
|
||||
SetVoltage:
|
||||
SetPositionSetpoint:
|
||||
SetVelocitySetpoint:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
classes:
|
||||
wpi::MotorController:
|
||||
methods:
|
||||
SetDutyCycle:
|
||||
SetThrottle:
|
||||
SetVoltage:
|
||||
GetDutyCycle:
|
||||
GetThrottle:
|
||||
SetInverted:
|
||||
GetInverted:
|
||||
Disable:
|
||||
|
||||
@@ -33,9 +33,9 @@ classes:
|
||||
param_override:
|
||||
args:
|
||||
ignore: true
|
||||
SetDutyCycle:
|
||||
SetThrottle:
|
||||
SetVoltage:
|
||||
GetDutyCycle:
|
||||
GetThrottle:
|
||||
SetInverted:
|
||||
GetInverted:
|
||||
Disable:
|
||||
|
||||
@@ -8,8 +8,8 @@ classes:
|
||||
attributes:
|
||||
m_pwm:
|
||||
methods:
|
||||
SetDutyCycle:
|
||||
GetDutyCycle:
|
||||
SetThrottle:
|
||||
GetThrottle:
|
||||
GetVoltage:
|
||||
SetInverted:
|
||||
GetInverted:
|
||||
|
||||
@@ -5,4 +5,4 @@ classes:
|
||||
overloads:
|
||||
const PWMMotorController&:
|
||||
int:
|
||||
GetDutyCycle:
|
||||
GetThrottle:
|
||||
|
||||
@@ -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); });
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user