CTRE_Phoenix 5.20.2
WPI_TalonFX.h
1
11#pragma once
12
13#include "ctre/phoenix/motorcontrol/can/TalonFX.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
25namespace ctre {
26namespace phoenix {
27namespace motorcontrol {
28namespace can {
29
33class WPI_TalonFX : public virtual TalonFX,
34 public virtual WPI_BaseMotorController
35{
36public:
43 WPI_TalonFX(int deviceNumber, std::string const &canbus = "");
44 virtual ~WPI_TalonFX();
45
46 WPI_TalonFX() = delete;
47 WPI_TalonFX(WPI_TalonFX const &) = delete;
48 WPI_TalonFX &operator=(WPI_TalonFX 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(TalonFXControlMode mode, double value);
55 virtual void Set(TalonFXControlMode mode, double demand0, DemandType demand1Type, double demand1);
56 virtual void SetVoltage(units::volt_t output);
57 virtual void SetInverted(TalonFXInvertType invertType);
58 virtual void SetInverted(InvertType invertType);
59 virtual void SetInverted(bool bInvert);
60 virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx = 0, int timeoutMs = 0);
61 virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx = 0, int timeoutMs = 0);
62
63protected:
64
65private:
66
67 hal::SimDevice m_simMotor;
68 hal::SimDouble m_simPercOut;
69 hal::SimDouble m_simMotorOutputLeadVoltage;
70 hal::SimDouble m_simSupplyCurrent;
71 hal::SimDouble m_simMotorCurrent;
72 hal::SimDouble m_simVbat;
73
74 hal::SimDevice m_simIntegSens;
75 hal::SimDouble m_simIntegSensPos;
76 hal::SimDouble m_simIntegSensAbsPos;
77 hal::SimDouble m_simIntegSensRawPos;
78 hal::SimDouble m_simIntegSensVel;
79
80 hal::SimDevice m_simFwdLim;
81 hal::SimBoolean m_simFwdLimInit;
82 hal::SimBoolean m_simFwdLimInput;
83 hal::SimBoolean m_simFwdLimValue;
84
85 hal::SimDevice m_simRevLim;
86 hal::SimBoolean m_simRevLimInit;
87 hal::SimBoolean m_simRevLimInput;
88 hal::SimBoolean m_simRevLimValue;
89
90 static void OnValueChanged(const char* name, void* param, HAL_SimValueHandle handle,
91 HAL_Bool readonly, const struct HAL_Value* value);
92 static void OnPeriodic(void* param);
93
94};
95
96} // namespace can
97} // namespace motorcontrol
98} // namespace phoenix
99} // namespace ctre
100
101#if _MSC_VER
102 #pragma warning(pop)
103#endif
Definition: WPI_BaseMotorController.h:56
WPI_TalonFX(int deviceNumber, std::string const &canbus="")
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(FeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
virtual void Set(ControlMode mode, double value)
virtual void SetInverted(InvertType invertType)
virtual void Set(ControlMode mode, double demand0, DemandType demand1Type, double demand1)
virtual void SetVoltage(units::volt_t output)
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
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
TalonFXControlMode
Definition: ControlMode.h:55
TalonFXInvertType
Definition: InvertType.h:24
ErrorCode
Definition: ErrorCode.h:12
Definition: ErrorCode.h:5