12 #include <hal/Types.h>
13 #include <wpi/raw_ostream.h>
15 #include "frc/ErrorBase.h"
16 #include "frc/MotorSafety.h"
17 #include "frc/smartdashboard/SendableBase.h"
21 class MotorSafetyHelper;
37 enum Value { kOff, kOn, kForward, kReverse };
38 enum Direction { kBothDirections, kForwardOnly, kReverseOnly };
49 explicit Relay(
int channel, Direction direction = kBothDirections);
73 void Set(Value value);
87 int GetChannel()
const;
141 Direction m_direction;
143 HAL_RelayHandle m_forwardHandle = HAL_kInvalidHandle;
144 HAL_RelayHandle m_reverseHandle = HAL_kInvalidHandle;
146 std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
Value Get() const
Get the Relay State.
Definition: SPIAccelerometerSim.h:18
bool IsSafetyEnabled() const override
Check if motor safety is enabled for this object.
Class for Spike style relay outputs.
Definition: Relay.h:35
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Definition: MotorSafety.h:16
Relay(int channel, Direction direction=kBothDirections)
Relay constructor given a channel.
void Set(Value value)
Set the relay state.
double GetExpiration() const override
Return the expiration time for the relay object.
bool IsAlive() const override
Check if the relay object is currently alive or stopped due to a timeout.
~Relay() override
Free the resource associated with a relay.
Base class for most objects.
Definition: ErrorBase.h:74
Definition: SendableBase.h:19
void SetExpiration(double timeout) override
Set the expiration time for the Relay object.
void StopMotor() override
Stop the motor associated with this PWM object.
Definition: SendableBuilder.h:23
void SetSafetyEnabled(bool enabled) override
Enable/disable motor safety for this device.