mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[wpilib] Rename MotorController setDutyCycle() to setThrottle() (#8720)
Fixes #8716.
This commit is contained in:
@@ -4,16 +4,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "wpi/hardware/expansionhub/ExpansionHub.hpp"
|
||||
#include "wpi/hardware/expansionhub/ExpansionHubPidConstants.hpp"
|
||||
#include "wpi/nt/BooleanTopic.hpp"
|
||||
#include "wpi/nt/DoubleTopic.hpp"
|
||||
#include "wpi/nt/IntegerTopic.hpp"
|
||||
#include "wpi/units/angle.hpp"
|
||||
#include "wpi/units/current.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
#include "wpi/units/voltage.hpp"
|
||||
|
||||
namespace wpi {
|
||||
@@ -33,12 +29,12 @@ class ExpansionHubMotor {
|
||||
~ExpansionHubMotor() noexcept;
|
||||
|
||||
/**
|
||||
* Sets the duty cycle.
|
||||
* Sets the throttle.
|
||||
*
|
||||
* @param dutyCycle The duty cycle between -1 and 1 (sign indicates
|
||||
* direction).
|
||||
* @param throttle The throttle where -1 indicates full reverse and 1
|
||||
* indicates full forward.
|
||||
*/
|
||||
void SetDutyCycle(double dutyCycle);
|
||||
void SetThrottle(double throttle);
|
||||
|
||||
/**
|
||||
* Sets the voltage to run the motor at. This value will be continously scaled
|
||||
|
||||
@@ -16,12 +16,12 @@ class MotorController {
|
||||
virtual ~MotorController() = default;
|
||||
|
||||
/**
|
||||
* Sets the duty cycle of the motor controller.
|
||||
* Sets the throttle of the motor controller.
|
||||
*
|
||||
* @param dutyCycle The duty cycle between -1 and 1 (sign indicates
|
||||
* direction).
|
||||
* @param throttle The throttle where -1 indicates full reverse and 1
|
||||
* indicates full forward.
|
||||
*/
|
||||
virtual void SetDutyCycle(double dutyCycle) = 0;
|
||||
virtual void SetThrottle(double throttle) = 0;
|
||||
|
||||
/**
|
||||
* Sets the voltage output of the motor controller.
|
||||
@@ -40,11 +40,12 @@ class MotorController {
|
||||
virtual void SetVoltage(wpi::units::volt_t voltage);
|
||||
|
||||
/**
|
||||
* Gets the duty cycle of the motor controller.
|
||||
* Gets the throttle of the motor controller.
|
||||
*
|
||||
* @return The duty cycle between -1 and 1 (sign indicates direction).
|
||||
* @return The throttle where -1 represents full reverse and 1 represents full
|
||||
* forward.
|
||||
*/
|
||||
virtual double GetDutyCycle() const = 0;
|
||||
virtual double GetThrottle() const = 0;
|
||||
|
||||
/**
|
||||
* Sets the inversion state of the motor controller.
|
||||
|
||||
@@ -17,14 +17,11 @@
|
||||
#include "wpi/hardware/motor/MotorController.hpp"
|
||||
#include "wpi/hardware/motor/MotorSafety.hpp"
|
||||
#include "wpi/units/voltage.hpp"
|
||||
#include "wpi/util/deprecated.hpp"
|
||||
#include "wpi/util/sendable/Sendable.hpp"
|
||||
#include "wpi/util/sendable/SendableHelper.hpp"
|
||||
|
||||
namespace wpi {
|
||||
|
||||
WPI_IGNORE_DEPRECATED
|
||||
|
||||
/**
|
||||
* Common base class for all PWM Motor Controllers.
|
||||
*/
|
||||
@@ -37,9 +34,9 @@ class PWMMotorController
|
||||
PWMMotorController(PWMMotorController&&) = default;
|
||||
PWMMotorController& operator=(PWMMotorController&&) = default;
|
||||
|
||||
void SetDutyCycle(double dutyCycle) override;
|
||||
void SetThrottle(double throttle) override;
|
||||
|
||||
double GetDutyCycle() const override;
|
||||
double GetThrottle() const override;
|
||||
|
||||
/**
|
||||
* Gets the voltage output of the motor controller, nominally between -12 V
|
||||
@@ -119,7 +116,7 @@ class PWMMotorController
|
||||
std::vector<std::unique_ptr<PWMMotorController>> m_owningFollowers;
|
||||
|
||||
wpi::hal::SimDevice m_simDevice;
|
||||
wpi::hal::SimDouble m_simDutyCycle;
|
||||
wpi::hal::SimDouble m_simThrottle;
|
||||
|
||||
bool m_eliminateDeadband{0};
|
||||
wpi::units::microsecond_t m_minPwm{0};
|
||||
@@ -136,6 +133,4 @@ class PWMMotorController
|
||||
PWM* GetPwm() { return &m_pwm; }
|
||||
};
|
||||
|
||||
WPI_UNIGNORE_DEPRECATED
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
Reference in New Issue
Block a user