CTRE Phoenix C++ 5.33.0
WPI_VictorSPX.h
Go to the documentation of this file.
1/* Copyright (C) Cross The Road Electronics 2024 */
2/**
3 * WPI Compliant motor controller class.
4 * WPILIB's object model requires many interfaces to be implemented to use
5 * the various features.
6 * This includes...
7 * - Software PID loops running in the robot controller
8 * - LiveWindow/Test mode features
9 * - Motor Safety (auto-turn off of motor if Set stops getting called)
10 * - Single Parameter set that assumes a simple motor controller.
11 */
12#pragma once
13
16#include "ctre/phoenix/platform/Platform.hpp"
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
32/**
33 * VEX Victor SPX Motor Controller when used on CAN Bus.
34 */
35class WPI_VictorSPX: public virtual VictorSPX,
36 public virtual WPI_BaseMotorController
37{
38public:
39 /**
40 * Constructor for a WPI_VictorSPX
41 * @param deviceNumber Device ID of VictorSPX
42 */
43 WPI_VictorSPX(int deviceNumber);
44 virtual ~WPI_VictorSPX();
45
46 WPI_VictorSPX() = delete;
47 WPI_VictorSPX(WPI_VictorSPX 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(VictorSPXControlMode mode, double value);
55 virtual void Set(VictorSPXControlMode 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(RemoteFeedbackDevice feedbackDevice, int pidIdx = 0, int timeoutMs = 0);
60
61protected:
62
63private:
64
65 hal::SimDevice m_simMotor;
66 hal::SimDouble m_simPercOut;
67 hal::SimDouble m_simMotorOutputLeadVoltage;
68 hal::SimDouble m_simVbat;
69
70 static void OnValueChanged(const char* name, void* param, HAL_SimValueHandle handle,
71 HAL_Bool readonly, const struct HAL_Value* value);
72 static void OnPeriodic(void* param);
73
74};
75
76} // namespace can
77} // namespace motorcontrol
78} // namespace phoenix
79} // namespace ctre
80
81#if _MSC_VER
82 #pragma warning(pop)
83#endif
VEX Victor SPX Motor Controller when used on CAN Bus.
Definition: VictorSPX.h:227
VEX Victor SPX Motor Controller when used on CAN Bus.
Definition: WPI_BaseMotorController.h:57
VEX Victor SPX Motor Controller when used on CAN Bus.
Definition: WPI_VictorSPX.h:37
virtual void Set(VictorSPXControlMode mode, double value)
virtual void Set(ControlMode mode, double demand0, DemandType demand1Type, double demand1)
virtual void Set(ControlMode mode, double value)
Sets the appropriate output on the talon, depending on the mode.
WPI_VictorSPX(WPI_VictorSPX const &)=delete
virtual void SetInverted(bool bInvert)
Common interface for inverting direction of a speed controller.
WPI_VictorSPX(int deviceNumber)
Constructor for a WPI_VictorSPX.
virtual void Set(VictorSPXControlMode mode, double demand0, DemandType demand1Type, double demand1)
virtual void Set(double value)
Common interface for setting the speed of a simple speed controller.
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
Select the remote feedback device for the motor controller.
virtual void SetInverted(InvertType invertType)
Common interface for inverting direction of a speed controller.
WPI_VictorSPX & operator=(WPI_VictorSPX const &)=delete
virtual void SetVoltage(units::volt_t output)
Sets the voltage output of the SpeedController.
ControlMode
Choose the control mode for a motor controller.
Definition: ControlMode.h:11
DemandType
How to interpret a demand value.
Definition: DemandType.h:10
InvertType
Choose the invert type of the motor controller.
Definition: InvertType.h:14
RemoteFeedbackDevice
Choose the remote feedback device for a motor controller.
Definition: FeedbackDevice.h:182
VictorSPXControlMode
Choose the control mode for a Victor SPX.
Definition: ControlMode.h:156
namespace phoenix
Definition: PigeonIMU_Faults.h:7
ErrorCode
Definition: ErrorCode.h:13
namespace ctre
Definition: PigeonIMU_Faults.h:6