19#include "wpi/units/voltage.hpp"
84 template <std::derived_from<PWMMotorController> T>
86 m_owningFollowers.emplace_back(
87 std::make_unique<std::decay_t<T>>(std::forward<T>(follower)));
108 wpi::units::microsecond_t deadbandMaxPwm,
109 wpi::units::microsecond_t centerPwm,
110 wpi::units::microsecond_t deadbandMinPwm,
111 wpi::units::microsecond_t minPwm);
114 bool m_isInverted =
false;
115 std::vector<PWMMotorController*> m_nonowningFollowers;
116 std::vector<std::unique_ptr<PWMMotorController>> m_owningFollowers;
121 bool m_eliminateDeadband{0};
122 wpi::units::microsecond_t m_minPwm{0};
123 wpi::units::microsecond_t m_deadbandMinPwm{0};
124 wpi::units::microsecond_t m_centerPwm{0};
125 wpi::units::microsecond_t m_deadbandMaxPwm{0};
126 wpi::units::microsecond_t m_maxPwm{0};
128 wpi::units::microsecond_t GetMinPositivePwm()
const;
129 wpi::units::microsecond_t GetMaxNegativePwm()
const;
130 wpi::units::microsecond_t GetPositiveScaleFactor()
const;
131 wpi::units::microsecond_t GetNegativeScaleFactor()
const;
@ name
Definition base.h:690
Interface for motor controlling devices.
Definition MotorController.hpp:14
Class for sending pulse-width modulation (PWM) signals.
Definition PWM.hpp:21
void SetThrottle(double throttle) override
Sets the throttle of the motor controller.
virtual wpi::units::volt_t GetVoltage() const
Gets the voltage output of the motor controller, nominally between -12 V and 12 V.
void Disable() override
Disables the motor controller.
PWMMotorController & operator=(PWMMotorController &&)=default
double GetDutyCycleInternal() const
double GetThrottle() const override
Gets the throttle of the motor controller.
void AddFollower(PWMMotorController &follower)
Make the given PWM motor controller follow the output of this one.
void SetInverted(bool isInverted) override
Sets the inversion state of the motor controller.
void SetDutyCycleInternal(double dutyCycle)
PWMMotorController(std::string_view name, int channel)
Constructor for a PWM Motor Controller connected via PWM.
void InitSendable(wpi::util::SendableBuilder &builder) override
Initializes this Sendable object.
bool GetInverted() const override
Gets the inversion state of the motor controller.
std::string GetDescription() const override
Returns a description to print when an error occurs.
PWMMotorController(PWMMotorController &&)=default
void EnableDeadbandElimination(bool eliminateDeadband)
Optionally eliminate the deadband from a motor controller.
void AddFollower(T &&follower)
Make the given PWM motor controller follow the output of this one.
Definition PWMMotorController.hpp:85
void SetBounds(wpi::units::microsecond_t maxPwm, wpi::units::microsecond_t deadbandMaxPwm, wpi::units::microsecond_t centerPwm, wpi::units::microsecond_t deadbandMinPwm, wpi::units::microsecond_t minPwm)
void StopMotor() override
Called to stop the motor when the timeout expires.
PWM m_pwm
PWM instances for motor controller.
Definition PWMMotorController.hpp:102
A move-only C++ wrapper around a HAL simulator device handle.
Definition SimDevice.hpp:278
C++ wrapper around a HAL simulator double value handle.
Definition SimDevice.hpp:169
Helper class for building Sendable dashboard representations.
Definition SendableBuilder.hpp:21
A helper class for use with objects that add themselves to SendableRegistry.
Definition SendableHelper.hpp:21
Interface for Sendable objects.
Definition Sendable.hpp:16
@ PWM
Definition HandlesInternal.hpp:61
Definition CvSource.hpp:15