CTRE_Phoenix 5.20.2
WPI_TalonSRX.h
1
11#pragma once
12
13#include "ctre/phoenix/motorcontrol/can/TalonSRX.h"
14#include "ctre/phoenix/motorcontrol/can/WPI_BaseMotorController.h"
15#include "ctre/phoenix/platform/Platform.h"
16#include "ctre/phoenix/WPI_CallbackHelper.h"
17
18
19//Turn off dominance warning
20#if _MSC_VER
21 #pragma warning(push)
22 #pragma warning(disable : 4250)
23#endif
24
25using namespace ctre::phoenix;
26
27namespace ctre {
28namespace phoenix {
29namespace motorcontrol {
30namespace can {
31
35class WPI_TalonSRX : public virtual TalonSRX,
36 public virtual WPI_BaseMotorController
37{
38public:
43 WPI_TalonSRX(int deviceNumber);
44 virtual ~WPI_TalonSRX();
45
46 WPI_TalonSRX() = delete;
47 WPI_TalonSRX(WPI_TalonSRX const &) = delete;
48 WPI_TalonSRX &operator=(WPI_TalonSRX const &) = delete;
49
50 /* ----- virtual re-directs ------- */
51 virtual void Set(double value);
52 virtual void Set(ControlMode mode, double value);
53 virtual void Set(ControlMode mode, double demand0, DemandType demand1Type, double demand1);
54 virtual void Set(TalonSRXControlMode mode, double value);
55 virtual void Set(TalonSRXControlMode mode, double demand0, DemandType demand1Type, double demand1);
56 virtual void SetVoltage(units::volt_t output);
57 virtual void SetInverted(InvertType invertType);
58 virtual void SetInverted(bool bInvert);
59 virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx = 0, int timeoutMs = 0);
60 virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx = 0, int timeoutMs = 0);
61protected:
62
63private:
64
65 hal::SimDevice m_simMotor;
66 hal::SimDouble m_simPercOut;
67 hal::SimDouble m_simMotorOutputLeadVoltage;
68 hal::SimDouble m_simSupplyCurrent;
69 hal::SimDouble m_simMotorCurrent;
70 hal::SimDouble m_simVbat;
71
72 hal::SimDevice m_simAnalogEnc;
73 hal::SimBoolean m_simAnalogInit;
74 hal::SimDouble m_simAnalogVoltage;
75
76 hal::SimDevice m_simPulseWidthEnc;
77 hal::SimBoolean m_simPulseWidthConnected;
78 hal::SimDouble m_simPulseWidthPos;
79
80 hal::SimDevice m_simQuadEnc;
81 hal::SimDouble m_simQuadPos;
82 hal::SimDouble m_simQuadRawPos;
83 hal::SimDouble m_simQuadVel;
84
85 hal::SimDevice m_simFwdLim;
86 hal::SimBoolean m_simFwdLimInit;
87 hal::SimBoolean m_simFwdLimInput;
88 hal::SimBoolean m_simFwdLimValue;
89
90 hal::SimDevice m_simRevLim;
91 hal::SimBoolean m_simRevLimInit;
92 hal::SimBoolean m_simRevLimInput;
93 hal::SimBoolean m_simRevLimValue;
94
95 static void OnValueChanged(const char* name, void* param, HAL_SimValueHandle handle,
96 HAL_Bool readonly, const struct HAL_Value* value);
97 static void OnPeriodic(void* param);
98
99};
100
101} // namespace can
102} // namespace motorcontrol
103} // namespace phoenix
104} // namespace ctre
105
106#if _MSC_VER
107 #pragma warning(pop)
108#endif
Definition: WPI_BaseMotorController.h:56
virtual void Set(ControlMode mode, double value)
virtual void Set(ControlMode mode, double demand0, DemandType demand1Type, double demand1)
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
virtual void SetInverted(InvertType invertType)
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
virtual void SetVoltage(units::volt_t output)
ControlMode
Definition: ControlMode.h:10
DemandType
Definition: DemandType.h:9
InvertType
Definition: InvertType.h:13
RemoteFeedbackDevice
Definition: FeedbackDevice.h:169
FeedbackDevice
Definition: FeedbackDevice.h:13
TalonSRXControlMode
Definition: ControlMode.h:101
Definition: ErrorCode.h:6
ErrorCode
Definition: ErrorCode.h:12
Definition: ErrorCode.h:5