mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[wpilib] Move motor controllers to motorcontrol package (#3302)
Also deprecate SpeedController in favor of motorcontrol.MotorController and SpeedControllerGroup in favor of motorcontrol.MotorControllerGroup. The MotorController interface is derived from the SpeedController interface so that code such as SpeedController x = new VictorSP(1) continues to compile (just with a warning). SpeedControllerGroup and MotorControllerGroup are independent classes; both implement the MotorController interface.
This commit is contained in:
41
wpilibc/src/main/native/include/frc/motorcontrol/DMC60.h
Normal file
41
wpilibc/src/main/native/include/frc/motorcontrol/DMC60.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Digilent DMC 60 Motor Controller.
|
||||
*
|
||||
* Note that the DMC 60 uses the following bounds for PWM values. These
|
||||
* values should work reasonably well for most controllers, but if users
|
||||
* experience issues such as asymmetric behavior around the deadband or
|
||||
* inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the DMC 60 User
|
||||
* Manual available from Digilent.
|
||||
*
|
||||
* \li 2.004ms = full "forward"
|
||||
* \li 1.520ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.480ms = the "low end" of the deadband range
|
||||
* \li 0.997ms = full "reverse"
|
||||
*/
|
||||
class DMC60 : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a Digilent DMC 60.
|
||||
*
|
||||
* @param channel The PWM channel that the DMC 60 is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit DMC60(int channel);
|
||||
|
||||
DMC60(DMC60&&) = default;
|
||||
DMC60& operator=(DMC60&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
41
wpilibc/src/main/native/include/frc/motorcontrol/Jaguar.h
Normal file
41
wpilibc/src/main/native/include/frc/motorcontrol/Jaguar.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Luminary Micro / Vex Robotics Jaguar Motor Controller with PWM control.
|
||||
*
|
||||
* Note that the Jaguar uses the following bounds for PWM values. These values
|
||||
* should work reasonably well for most controllers, but if users experience
|
||||
* issues such as asymmetric behavior around the deadband or inability to
|
||||
* saturate the controller in either direction, calibration is recommended. The
|
||||
* calibration procedure can be found in the Jaguar User Manual available from
|
||||
* Vex.
|
||||
*
|
||||
* \li 2.310ms = full "forward"
|
||||
* \li 1.550ms = the "high end" of the deadband range
|
||||
* \li 1.507ms = center of the deadband range (off)
|
||||
* \li 1.454ms = the "low end" of the deadband range
|
||||
* \li 0.697ms = full "reverse"
|
||||
*/
|
||||
class Jaguar : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a Jaguar connected via PWM.
|
||||
*
|
||||
* @param channel The PWM channel that the Jaguar is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit Jaguar(int channel);
|
||||
|
||||
Jaguar(Jaguar&&) = default;
|
||||
Jaguar& operator=(Jaguar&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/voltage.h>
|
||||
|
||||
#include "frc/SpeedController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996) // was declared deprecated
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Interface for motor controlling devices.
|
||||
*/
|
||||
class MotorController : public SpeedController {};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "frc/motorcontrol/MotorController.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class MotorControllerGroup : public Sendable,
|
||||
public MotorController,
|
||||
public SendableHelper<MotorControllerGroup> {
|
||||
public:
|
||||
template <class... MotorControllers>
|
||||
explicit MotorControllerGroup(MotorController& motorController,
|
||||
MotorControllers&... motorControllers);
|
||||
explicit MotorControllerGroup(
|
||||
std::vector<std::reference_wrapper<MotorController>>&& motorControllers);
|
||||
|
||||
MotorControllerGroup(MotorControllerGroup&&) = default;
|
||||
MotorControllerGroup& operator=(MotorControllerGroup&&) = default;
|
||||
|
||||
void Set(double speed) override;
|
||||
double Get() const override;
|
||||
void SetInverted(bool isInverted) override;
|
||||
bool GetInverted() const override;
|
||||
void Disable() override;
|
||||
void StopMotor() override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
bool m_isInverted = false;
|
||||
std::vector<std::reference_wrapper<MotorController>> m_motorControllers;
|
||||
|
||||
void Initialize();
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
#include "frc/motorcontrol/MotorControllerGroup.inc"
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "frc/motorcontrol/MotorControllerGroup.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
template <class... MotorControllers>
|
||||
MotorControllerGroup::MotorControllerGroup(
|
||||
MotorController& motorController, MotorControllers&... motorControllers)
|
||||
: m_motorControllers(std::vector<std::reference_wrapper<MotorController>>{
|
||||
motorController, motorControllers...}) {
|
||||
Initialize();
|
||||
}
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,98 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/DigitalOutput.h"
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/MotorSafety.h"
|
||||
#include "frc/PWM.h"
|
||||
#include "frc/motorcontrol/MotorController.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class SendableBuilder;
|
||||
|
||||
/**
|
||||
* Nidec Brushless Motor.
|
||||
*/
|
||||
class NidecBrushless : public MotorController,
|
||||
public MotorSafety,
|
||||
public Sendable,
|
||||
public SendableHelper<NidecBrushless> {
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param pwmChannel The PWM channel that the Nidec Brushless controller is
|
||||
* attached to. 0-9 are on-board, 10-19 are on the MXP port.
|
||||
* @param dioChannel The DIO channel that the Nidec Brushless controller is
|
||||
* attached to. 0-9 are on-board, 10-25 are on the MXP port.
|
||||
*/
|
||||
NidecBrushless(int pwmChannel, int dioChannel);
|
||||
|
||||
~NidecBrushless() override = default;
|
||||
|
||||
NidecBrushless(NidecBrushless&&) = default;
|
||||
NidecBrushless& operator=(NidecBrushless&&) = default;
|
||||
|
||||
// MotorController interface
|
||||
/**
|
||||
* Set the PWM value.
|
||||
*
|
||||
* The PWM value is set using a range of -1.0 to 1.0, appropriately scaling
|
||||
* the value for the FPGA.
|
||||
*
|
||||
* @param speed The speed value between -1.0 and 1.0 to set.
|
||||
*/
|
||||
void Set(double speed) override;
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
*
|
||||
* @return The most recently set value for the PWM between -1.0 and 1.0.
|
||||
*/
|
||||
double Get() const override;
|
||||
|
||||
void SetInverted(bool isInverted) override;
|
||||
|
||||
bool GetInverted() const override;
|
||||
|
||||
/**
|
||||
* Disable the motor. The Enable() function must be called to re-enable the
|
||||
* motor.
|
||||
*/
|
||||
void Disable() override;
|
||||
|
||||
/**
|
||||
* Re-enable the motor after Disable() has been called. The Set() function
|
||||
* must be called to set a new motor speed.
|
||||
*/
|
||||
void Enable();
|
||||
|
||||
// MotorSafety interface
|
||||
void StopMotor() override;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
|
||||
/**
|
||||
* Gets the channel number associated with the object.
|
||||
*
|
||||
* @return The channel number.
|
||||
*/
|
||||
int GetChannel() const;
|
||||
|
||||
// Sendable interface
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
bool m_isInverted = false;
|
||||
bool m_disabled = false;
|
||||
DigitalOutput m_dio;
|
||||
PWM m_pwm;
|
||||
double m_speed = 0.0;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,81 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/MotorSafety.h"
|
||||
#include "frc/PWM.h"
|
||||
#include "frc/motorcontrol/MotorController.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace wpi {
|
||||
class raw_ostream;
|
||||
} // namespace wpi
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Common base class for all PWM Motor Controllers.
|
||||
*/
|
||||
class PWMMotorController : public MotorController,
|
||||
public MotorSafety,
|
||||
public Sendable,
|
||||
public SendableHelper<PWMMotorController> {
|
||||
public:
|
||||
PWMMotorController(PWMMotorController&&) = default;
|
||||
PWMMotorController& operator=(PWMMotorController&&) = default;
|
||||
|
||||
/**
|
||||
* Set the PWM value.
|
||||
*
|
||||
* The PWM value is set using a range of -1.0 to 1.0, appropriately scaling
|
||||
* the value for the FPGA.
|
||||
*
|
||||
* @param speed The speed value between -1.0 and 1.0 to set.
|
||||
*/
|
||||
void Set(double value) override;
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM. This value is affected by the
|
||||
* inversion property. If you want the value that is sent directly to the
|
||||
* MotorController, use {@link PWM#getSpeed()} instead.
|
||||
*
|
||||
* @return The most recently set value for the PWM between -1.0 and 1.0.
|
||||
*/
|
||||
double Get() const override;
|
||||
|
||||
void SetInverted(bool isInverted) override;
|
||||
|
||||
bool GetInverted() const override;
|
||||
|
||||
void Disable() override;
|
||||
|
||||
// MotorSafety interface
|
||||
void StopMotor() override;
|
||||
void GetDescription(wpi::raw_ostream& desc) const override;
|
||||
|
||||
int GetChannel() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Constructor for a PWM Motor Controller connected via PWM.
|
||||
*
|
||||
* @param name Name to use for SendableRegistry
|
||||
* @param channel The PWM channel that the controller is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
PWMMotorController(const wpi::Twine& name, int channel);
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
PWM m_pwm;
|
||||
|
||||
private:
|
||||
bool m_isInverted = false;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* REV Robotics SPARK MAX Motor Controller.
|
||||
*
|
||||
* Note that the SPARK MAX uses the following bounds for PWM values. These
|
||||
* values should work reasonably well for most controllers, but if users
|
||||
* experience issues such as asymmetric behavior around the deadband or
|
||||
* inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the SPARK MAX User
|
||||
* Manual available from REV Robotics.
|
||||
*
|
||||
* \li 2.003ms = full "forward"
|
||||
* \li 1.550ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.460ms = the "low end" of the deadband range
|
||||
* \li 0.999ms = full "reverse"
|
||||
*/
|
||||
class PWMSparkMax : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a SPARK MAX.
|
||||
*
|
||||
* @param channel The PWM channel that the SPARK MAX is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit PWMSparkMax(int channel);
|
||||
|
||||
PWMSparkMax(PWMSparkMax&&) = default;
|
||||
PWMSparkMax& operator=(PWMSparkMax&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Talon FX Motor Controller with PWM
|
||||
* control.
|
||||
*
|
||||
* Note that the Talon FX uses the following bounds for PWM values. These
|
||||
* values should work reasonably well for most controllers, but if users
|
||||
* experience issues such as asymmetric behavior around the deadband or
|
||||
* inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Talon FX User
|
||||
* Manual available from Cross The Road Electronics.
|
||||
*
|
||||
* \li 2.004ms = full "forward"
|
||||
* \li 1.520ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.480ms = the "low end" of the deadband range
|
||||
* \li 0.997ms = full "reverse"
|
||||
*/
|
||||
class PWMTalonFX : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Construct a Talon FX connected via PWM.
|
||||
*
|
||||
* @param channel The PWM channel that the Talon FX is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit PWMTalonFX(int channel);
|
||||
|
||||
PWMTalonFX(PWMTalonFX&&) = default;
|
||||
PWMTalonFX& operator=(PWMTalonFX&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM
|
||||
* control.
|
||||
*
|
||||
* Note that the Talon SRX uses the following bounds for PWM values. These
|
||||
* values should work reasonably well for most controllers, but if users
|
||||
* experience issues such as asymmetric behavior around the deadband or
|
||||
* inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Talon SRX User
|
||||
* Manual available from Cross The Road Electronics.
|
||||
*
|
||||
* \li 2.004ms = full "forward"
|
||||
* \li 1.520ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.480ms = the "low end" of the deadband range
|
||||
* \li 0.997ms = full "reverse"
|
||||
*/
|
||||
class PWMTalonSRX : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Construct a Talon SRX connected via PWM.
|
||||
*
|
||||
* @param channel The PWM channel that the Talon SRX is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit PWMTalonSRX(int channel);
|
||||
|
||||
PWMTalonSRX(PWMTalonSRX&&) = default;
|
||||
PWMTalonSRX& operator=(PWMTalonSRX&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
40
wpilibc/src/main/native/include/frc/motorcontrol/PWMVenom.h
Normal file
40
wpilibc/src/main/native/include/frc/motorcontrol/PWMVenom.h
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Playing with Fusion Venom Smart Motor with PWM control.
|
||||
*
|
||||
* Note that the Venom uses the following bounds for PWM values. These
|
||||
* values should work reasonably well for most controllers, but if users
|
||||
* experience issues such as asymmetric behavior around the deadband or
|
||||
* inability to saturate the controller in either direction, calibration is
|
||||
* recommended.
|
||||
*
|
||||
* \li 2.004ms = full "forward"
|
||||
* \li 1.520ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.480ms = the "low end" of the deadband range
|
||||
* \li 0.997ms = full "reverse"
|
||||
*/
|
||||
class PWMVenom : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Construct a Venom connected via PWM.
|
||||
*
|
||||
* @param channel The PWM channel that the Venom is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit PWMVenom(int channel);
|
||||
|
||||
PWMVenom(PWMVenom&&) = default;
|
||||
PWMVenom& operator=(PWMVenom&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Victor SPX Motor Controller with PWM
|
||||
* control.
|
||||
*
|
||||
* Note that the Victor SPX uses the following bounds for PWM values. These
|
||||
* values should work reasonably well for most controllers, but if users
|
||||
* experience issues such as asymmetric behavior around the deadband or
|
||||
* inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Victor SPX User
|
||||
* Manual available from Cross The Road Electronics.
|
||||
*
|
||||
* \li 2.004ms = full "forward"
|
||||
* \li 1.520ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.480ms = the "low end" of the deadband range
|
||||
* \li 0.997ms = full "reverse"
|
||||
*/
|
||||
class PWMVictorSPX : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Construct a Victor SPX connected via PWM.
|
||||
*
|
||||
* @param channel The PWM channel that the Victor SPX is attached to. 0-9
|
||||
* are on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit PWMVictorSPX(int channel);
|
||||
|
||||
PWMVictorSPX(PWMVictorSPX&&) = default;
|
||||
PWMVictorSPX& operator=(PWMVictorSPX&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
41
wpilibc/src/main/native/include/frc/motorcontrol/SD540.h
Normal file
41
wpilibc/src/main/native/include/frc/motorcontrol/SD540.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Mindsensors SD540 Motor Controller.
|
||||
*
|
||||
* Note that the SD540 uses the following bounds for PWM values. These values
|
||||
* should work reasonably well for most controllers, but if users experience
|
||||
* issues such as asymmetric behavior around the deadband or inability to
|
||||
* saturate the controller in either direction, calibration is recommended.
|
||||
* The calibration procedure can be found in the SD540 User Manual available
|
||||
* from Mindsensors.
|
||||
*
|
||||
* \li 2.05ms = full "forward"
|
||||
* \li 1.55ms = the "high end" of the deadband range
|
||||
* \li 1.50ms = center of the deadband range (off)
|
||||
* \li 1.44ms = the "low end" of the deadband range
|
||||
* \li 0.94ms = full "reverse"
|
||||
*/
|
||||
class SD540 : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a SD540.
|
||||
*
|
||||
* @param channel The PWM channel that the SD540 is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit SD540(int channel);
|
||||
|
||||
SD540(SD540&&) = default;
|
||||
SD540& operator=(SD540&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
41
wpilibc/src/main/native/include/frc/motorcontrol/Spark.h
Normal file
41
wpilibc/src/main/native/include/frc/motorcontrol/Spark.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* REV Robotics SPARK Motor Controller.
|
||||
*
|
||||
* Note that the SPARK uses the following bounds for PWM values. These values
|
||||
* should work reasonably well for most controllers, but if users experience
|
||||
* issues such as asymmetric behavior around the deadband or inability to
|
||||
* saturate the controller in either direction, calibration is recommended.
|
||||
* The calibration procedure can be found in the SPARK User Manual available
|
||||
* from REV Robotics.
|
||||
*
|
||||
* \li 2.003ms = full "forward"
|
||||
* \li 1.550ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.460ms = the "low end" of the deadband range
|
||||
* \li 0.999ms = full "reverse"
|
||||
*/
|
||||
class Spark : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a SPARK.
|
||||
*
|
||||
* @param channel The PWM channel that the SPARK is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit Spark(int channel);
|
||||
|
||||
Spark(Spark&&) = default;
|
||||
Spark& operator=(Spark&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
41
wpilibc/src/main/native/include/frc/motorcontrol/Talon.h
Normal file
41
wpilibc/src/main/native/include/frc/motorcontrol/Talon.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Talon and Talon SR Motor Controller.
|
||||
*
|
||||
* Note that the Talon uses the following bounds for PWM values. These values
|
||||
* should work reasonably well for most controllers, but if users experience
|
||||
* issues such as asymmetric behavior around the deadband or inability to
|
||||
* saturate the controller in either direction, calibration is recommended.
|
||||
* The calibration procedure can be found in the Talon User Manual available
|
||||
* from CTRE.
|
||||
*
|
||||
* \li 2.037ms = full "forward"
|
||||
* \li 1.539ms = the "high end" of the deadband range
|
||||
* \li 1.513ms = center of the deadband range (off)
|
||||
* \li 1.487ms = the "low end" of the deadband range
|
||||
* \li 0.989ms = full "reverse"
|
||||
*/
|
||||
class Talon : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a Talon (original or Talon SR).
|
||||
*
|
||||
* @param channel The PWM channel number that the Talon is attached to. 0-9
|
||||
* are on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit Talon(int channel);
|
||||
|
||||
Talon(Talon&&) = default;
|
||||
Talon& operator=(Talon&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
45
wpilibc/src/main/native/include/frc/motorcontrol/Victor.h
Normal file
45
wpilibc/src/main/native/include/frc/motorcontrol/Victor.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Vex Robotics Victor 888 Motor Controller.
|
||||
*
|
||||
* The Vex Robotics Victor 884 Motor Controller can also be used with this
|
||||
* class but may need to be calibrated per the Victor 884 user manual.
|
||||
*
|
||||
* Note that the Victor uses the following bounds for PWM values. These
|
||||
* values were determined empirically and optimized for the Victor 888. These
|
||||
* values should work reasonably well for Victor 884 controllers as well but
|
||||
* if users experience issues such as asymmetric behavior around the deadband
|
||||
* or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Victor 884 User
|
||||
* Manual available from Vex.
|
||||
*
|
||||
* \li 2.027ms = full "forward"
|
||||
* \li 1.525ms = the "high end" of the deadband range
|
||||
* \li 1.507ms = center of the deadband range (off)
|
||||
* \li 1.490ms = the "low end" of the deadband range
|
||||
* \li 1.026ms = full "reverse"
|
||||
*/
|
||||
class Victor : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a Victor.
|
||||
*
|
||||
* @param channel The PWM channel number that the Victor is attached to. 0-9
|
||||
* are on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit Victor(int channel);
|
||||
|
||||
Victor(Victor&&) = default;
|
||||
Victor& operator=(Victor&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
41
wpilibc/src/main/native/include/frc/motorcontrol/VictorSP.h
Normal file
41
wpilibc/src/main/native/include/frc/motorcontrol/VictorSP.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/motorcontrol/PWMMotorController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Vex Robotics Victor SP Motor Controller.
|
||||
*
|
||||
* Note that the Victor SP uses the following bounds for PWM values. These
|
||||
* values should work reasonably well for most controllers, but if users
|
||||
* experience issues such as asymmetric behavior around the deadband or
|
||||
* inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Victor SP User
|
||||
* Manual available from Vex.
|
||||
*
|
||||
* \li 2.004ms = full "forward"
|
||||
* \li 1.520ms = the "high end" of the deadband range
|
||||
* \li 1.500ms = center of the deadband range (off)
|
||||
* \li 1.480ms = the "low end" of the deadband range
|
||||
* \li 0.997ms = full "reverse"
|
||||
*/
|
||||
class VictorSP : public PWMMotorController {
|
||||
public:
|
||||
/**
|
||||
* Constructor for a Victor SP.
|
||||
*
|
||||
* @param channel The PWM channel that the VictorSP is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
explicit VictorSP(int channel);
|
||||
|
||||
VictorSP(VictorSP&&) = default;
|
||||
VictorSP& operator=(VictorSP&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user