19#include "wpi/units/voltage.hpp"
87 template <std::derived_from<PWMMotorController> T>
89 m_owningFollowers.emplace_back(
90 std::make_unique<std::decay_t<T>>(std::forward<T>(follower)));
112 wpi::units::microsecond_t deadbandMaxPwm,
113 wpi::units::microsecond_t centerPwm,
114 wpi::units::microsecond_t deadbandMinPwm,
115 wpi::units::microsecond_t minPwm);
118 bool m_isInverted =
false;
119 std::vector<PWMMotorController*> m_nonowningFollowers;
120 std::vector<std::unique_ptr<PWMMotorController>> m_owningFollowers;
125 bool m_eliminateDeadband{0};
126 wpi::units::microsecond_t m_minPwm{0};
127 wpi::units::microsecond_t m_deadbandMinPwm{0};
128 wpi::units::microsecond_t m_centerPwm{0};
129 wpi::units::microsecond_t m_deadbandMaxPwm{0};
130 wpi::units::microsecond_t m_maxPwm{0};
132 wpi::units::microsecond_t GetMinPositivePwm()
const;
133 wpi::units::microsecond_t GetMaxNegativePwm()
const;
134 wpi::units::microsecond_t GetPositiveScaleFactor()
const;
135 wpi::units::microsecond_t GetNegativeScaleFactor()
const;
@ name
Definition base.h:690
Interface for motor controlling devices.
Definition MotorController.hpp:14
Class implements the PWM generation in the FPGA.
Definition PWM.hpp:26
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
void SetDutyCycle(double dutyCycle) override
Sets the duty cycle of the motor controller.
double GetDutyCycleInternal() const
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
double GetDutyCycle() const override
Gets the duty cycle of the motor controller.
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:88
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:106
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
#define WPI_IGNORE_DEPRECATED
Definition deprecated.hpp:15
#define WPI_UNIGNORE_DEPRECATED
Definition deprecated.hpp:26
@ PWM
Definition HandlesInternal.hpp:55
Definition CvSource.hpp:15