From 9e99df1cf70a297487cb08ee25286170f03414ea Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Mon, 23 May 2016 20:42:58 -0700 Subject: [PATCH] Removed sync group from SpeedController interface (#51) CANJaguar is the only motor controller using sync groups, so that feature doesn't belong in an interface used by all motor controllers. If teams want to use sync groups, they should cast to the appropriate motor controller type themselves. --- wpilibc/athena/include/CANJaguar.h | 4 +- wpilibc/athena/include/CANSpeedController.h | 2 +- wpilibc/athena/include/CANTalon.h | 2 +- wpilibc/athena/include/PWMSpeedController.h | 4 +- wpilibc/athena/include/RobotDrive.h | 2 - wpilibc/athena/include/SpeedController.h | 4 +- wpilibc/athena/src/CANJaguar.cpp | 17 ++++++ wpilibc/athena/src/CANTalon.cpp | 2 +- wpilibc/athena/src/PWMSpeedController.cpp | 5 +- wpilibc/athena/src/RobotDrive.cpp | 54 +++++-------------- wpilibc/sim/include/Jaguar.h | 2 +- wpilibc/sim/include/SpeedController.h | 6 +-- wpilibc/sim/include/Talon.h | 2 +- wpilibc/sim/include/Victor.h | 2 +- wpilibc/sim/src/Jaguar.cpp | 5 +- wpilibc/sim/src/RobotDrive.cpp | 48 +++++------------ wpilibc/sim/src/Talon.cpp | 5 +- wpilibc/sim/src/Victor.cpp | 5 +- .../java/edu/wpi/first/wpilibj/CANJaguar.java | 1 - .../java/edu/wpi/first/wpilibj/CANTalon.java | 11 ---- .../wpi/first/wpilibj/PWMSpeedController.java | 19 ------- .../edu/wpi/first/wpilibj/RobotDrive.java | 48 +++++------------ .../wpi/first/wpilibj/SpeedController.java | 9 ---- .../java/edu/wpi/first/wpilibj/Jaguar.java | 16 ------ .../edu/wpi/first/wpilibj/RobotDrive.java | 30 +++++------ .../sim/java/edu/wpi/first/wpilibj/Servo.java | 14 ----- .../wpi/first/wpilibj/SpeedController.java | 9 ---- .../sim/java/edu/wpi/first/wpilibj/Talon.java | 16 ------ .../java/edu/wpi/first/wpilibj/Victor.java | 16 ------ 29 files changed, 87 insertions(+), 273 deletions(-) diff --git a/wpilibc/athena/include/CANJaguar.h b/wpilibc/athena/include/CANJaguar.h index d68d8ca40d..b6ffa3cace 100644 --- a/wpilibc/athena/include/CANJaguar.h +++ b/wpilibc/athena/include/CANJaguar.h @@ -92,9 +92,11 @@ class CANJaguar : public MotorSafety, void SetVoltageMode(QuadEncoderStruct, uint16_t codesPerRev); void SetVoltageMode(PotentiometerStruct); + void Set(float value, uint8_t syncGroup); + // CANSpeedController interface virtual float Get() const override; - virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual void Set(float value) override; virtual void Disable() override; virtual void SetP(double p) override; virtual void SetI(double i) override; diff --git a/wpilibc/athena/include/CANSpeedController.h b/wpilibc/athena/include/CANSpeedController.h index 20aae9c065..ccd3710e23 100644 --- a/wpilibc/athena/include/CANSpeedController.h +++ b/wpilibc/athena/include/CANSpeedController.h @@ -64,7 +64,7 @@ class CANSpeedController : public SpeedController { }; virtual float Get() const = 0; - virtual void Set(float value, uint8_t syncGroup = 0) = 0; + virtual void Set(float value) = 0; virtual void StopMotor() = 0; virtual void Disable() = 0; virtual void SetP(double p) = 0; diff --git a/wpilibc/athena/include/CANTalon.h b/wpilibc/athena/include/CANTalon.h index 4ff86fcdd6..b831595503 100644 --- a/wpilibc/athena/include/CANTalon.h +++ b/wpilibc/athena/include/CANTalon.h @@ -242,7 +242,7 @@ class CANTalon : public MotorSafety, // CANSpeedController interface virtual float Get() const override; - virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual void Set(float value) override; virtual void Reset() override; virtual void SetSetpoint(float value) override; virtual void Disable() override; diff --git a/wpilibc/athena/include/PWMSpeedController.h b/wpilibc/athena/include/PWMSpeedController.h index 363f72f4ff..92a92a62a8 100644 --- a/wpilibc/athena/include/PWMSpeedController.h +++ b/wpilibc/athena/include/PWMSpeedController.h @@ -16,7 +16,7 @@ class PWMSpeedController : public SafePWM, public SpeedController { public: virtual ~PWMSpeedController() = default; - virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual void Set(float value) override; virtual float Get() const override; virtual void Disable() override; virtual void StopMotor() override; @@ -31,4 +31,4 @@ class PWMSpeedController : public SafePWM, public SpeedController { private: bool m_isInverted = false; -}; \ No newline at end of file +}; diff --git a/wpilibc/athena/include/RobotDrive.h b/wpilibc/athena/include/RobotDrive.h index 423b7f0cc8..fb1f37c08a 100644 --- a/wpilibc/athena/include/RobotDrive.h +++ b/wpilibc/athena/include/RobotDrive.h @@ -87,7 +87,6 @@ class RobotDrive : public MotorSafety, public ErrorBase { void SetInvertedMotor(MotorType motor, bool isInverted); void SetSensitivity(float sensitivity); void SetMaxOutput(double maxOutput); - void SetCANJaguarSyncGroup(uint8_t syncGroup); void SetExpiration(float timeout) override; float GetExpiration() const override; @@ -111,7 +110,6 @@ class RobotDrive : public MotorSafety, public ErrorBase { std::shared_ptr m_rearLeftMotor; std::shared_ptr m_rearRightMotor; std::unique_ptr m_safetyHelper; - uint8_t m_syncGroup = 0; private: int32_t GetNumMotors() { diff --git a/wpilibc/athena/include/SpeedController.h b/wpilibc/athena/include/SpeedController.h index bc9bc6c066..c9f4b2eca5 100644 --- a/wpilibc/athena/include/SpeedController.h +++ b/wpilibc/athena/include/SpeedController.h @@ -20,10 +20,8 @@ class SpeedController : public PIDOutput { * Common interface for setting the speed of a speed controller. * * @param speed The speed to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending - * UpdateSyncGroup(). If 0, update immediately. */ - virtual void Set(float speed, uint8_t syncGroup = 0) = 0; + virtual void Set(float speed) = 0; /** * Common interface for getting the current set speed of a speed controller. diff --git a/wpilibc/athena/src/CANJaguar.cpp b/wpilibc/athena/src/CANJaguar.cpp index 5f76ccddd4..f9111cd76f 100644 --- a/wpilibc/athena/src/CANJaguar.cpp +++ b/wpilibc/athena/src/CANJaguar.cpp @@ -1523,6 +1523,23 @@ void CANJaguar::SetVoltageMode(CANJaguar::PotentiometerStruct) { ConfigPotentiometerTurns(1); } +/** + * Sets the output set-point value. + * + * The scale and the units depend on the mode the Jaguar is in. + *

In percentVbus Mode, the outputValue is from -1.0 to 1.0 (same as PWM + * Jaguar). + *

In voltage Mode, the outputValue is in volts. + *

In current Mode, the outputValue is in amps. + *

In speed Mode, the outputValue is in rotations/minute. + *

In position Mode, the outputValue is in rotations. + * + * @param outputValue The set-point to sent to the motor controller. + */ +void CANJaguar::Set(float outputValue) { + Set(outputValue, 0); +} + /** * Used internally. In order to set the control mode see the methods listed * below. diff --git a/wpilibc/athena/src/CANTalon.cpp b/wpilibc/athena/src/CANTalon.cpp index fb6b66824b..2d3f5f36ab 100644 --- a/wpilibc/athena/src/CANTalon.cpp +++ b/wpilibc/athena/src/CANTalon.cpp @@ -132,7 +132,7 @@ float CANTalon::Get() const { * @param outputValue The setpoint value, as described above. * @see SelectProfileSlot to choose between the two sets of gains. */ -void CANTalon::Set(float value, uint8_t syncGroup) { +void CANTalon::Set(float value) { /* feed safety helper since caller just updated our output */ m_safetyHelper->Feed(); diff --git a/wpilibc/athena/src/PWMSpeedController.cpp b/wpilibc/athena/src/PWMSpeedController.cpp index e117889849..e8f5211dcf 100644 --- a/wpilibc/athena/src/PWMSpeedController.cpp +++ b/wpilibc/athena/src/PWMSpeedController.cpp @@ -21,10 +21,9 @@ PWMSpeedController::PWMSpeedController(uint32_t channel) : SafePWM(channel) {} * 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. - * @param syncGroup Unused interface. + * @param speed The speed value between -1.0 and 1.0 to set. */ -void PWMSpeedController::Set(float speed, uint8_t syncGroup) { +void PWMSpeedController::Set(float speed) { SetSpeed(m_isInverted ? -speed : speed); } diff --git a/wpilibc/athena/src/RobotDrive.cpp b/wpilibc/athena/src/RobotDrive.cpp index 8617b4229b..ac482a1094 100644 --- a/wpilibc/athena/src/RobotDrive.cpp +++ b/wpilibc/athena/src/RobotDrive.cpp @@ -8,7 +8,6 @@ #include "RobotDrive.h" #include -#include "CANJaguar.h" #include "GenericHID.h" #include "Joystick.h" #include "Talon.h" @@ -522,17 +521,10 @@ void RobotDrive::MecanumDrive_Cartesian(float x, float y, float rotation, Normalize(wheelSpeeds); - m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * m_maxOutput, - m_syncGroup); - m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * m_maxOutput, - m_syncGroup); - m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * m_maxOutput, m_syncGroup); - m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * m_maxOutput, - m_syncGroup); - - if (m_syncGroup != 0) { - CANJaguar::UpdateSyncGroup(m_syncGroup); - } + m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * m_maxOutput); + m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * m_maxOutput); + m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * m_maxOutput); + m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * m_maxOutput); m_safetyHelper->Feed(); } @@ -578,17 +570,10 @@ void RobotDrive::MecanumDrive_Polar(float magnitude, float direction, Normalize(wheelSpeeds); - m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * m_maxOutput, - m_syncGroup); - m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * m_maxOutput, - m_syncGroup); - m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * m_maxOutput, m_syncGroup); - m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * m_maxOutput, - m_syncGroup); - - if (m_syncGroup != 0) { - CANJaguar::UpdateSyncGroup(m_syncGroup); - } + m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * m_maxOutput); + m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * m_maxOutput); + m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * m_maxOutput); + m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * m_maxOutput); m_safetyHelper->Feed(); } @@ -624,16 +609,12 @@ void RobotDrive::SetLeftRightMotorOutputs(float leftOutput, float rightOutput) { wpi_assert(m_rearLeftMotor != nullptr && m_rearRightMotor != nullptr); if (m_frontLeftMotor != nullptr) - m_frontLeftMotor->Set(Limit(leftOutput) * m_maxOutput, m_syncGroup); - m_rearLeftMotor->Set(Limit(leftOutput) * m_maxOutput, m_syncGroup); + m_frontLeftMotor->Set(Limit(leftOutput) * m_maxOutput); + m_rearLeftMotor->Set(Limit(leftOutput) * m_maxOutput); if (m_frontRightMotor != nullptr) - m_frontRightMotor->Set(-Limit(rightOutput) * m_maxOutput, m_syncGroup); - m_rearRightMotor->Set(-Limit(rightOutput) * m_maxOutput, m_syncGroup); - - if (m_syncGroup != 0) { - CANJaguar::UpdateSyncGroup(m_syncGroup); - } + m_frontRightMotor->Set(-Limit(rightOutput) * m_maxOutput); + m_rearRightMotor->Set(-Limit(rightOutput) * m_maxOutput); m_safetyHelper->Feed(); } @@ -732,17 +713,6 @@ void RobotDrive::SetSensitivity(float sensitivity) { */ void RobotDrive::SetMaxOutput(double maxOutput) { m_maxOutput = maxOutput; } -/** - * Set the number of the sync group for the motor controllers. If the motor - * controllers are {@link CANJaguar}s, then they will all be added to this sync - * group, causing them to update their values at the same time. - * - * @param syncGroup the update group to add the motor controllers to - */ -void RobotDrive::SetCANJaguarSyncGroup(uint8_t syncGroup) { - m_syncGroup = syncGroup; -} - void RobotDrive::SetExpiration(float timeout) { m_safetyHelper->SetExpiration(timeout); } diff --git a/wpilibc/sim/include/Jaguar.h b/wpilibc/sim/include/Jaguar.h index c71b81890c..b5dc1caf76 100644 --- a/wpilibc/sim/include/Jaguar.h +++ b/wpilibc/sim/include/Jaguar.h @@ -18,7 +18,7 @@ class Jaguar : public SafePWM, public SpeedController { public: explicit Jaguar(uint32_t channel); virtual ~Jaguar() = default; - virtual void Set(float value, uint8_t syncGroup = 0); + virtual void Set(float value); virtual float Get() const; virtual void Disable(); diff --git a/wpilibc/sim/include/SpeedController.h b/wpilibc/sim/include/SpeedController.h index b102981d0c..350e08b0f6 100644 --- a/wpilibc/sim/include/SpeedController.h +++ b/wpilibc/sim/include/SpeedController.h @@ -18,11 +18,9 @@ class SpeedController : public PIDOutput { /** * Common interface for setting the speed of a speed controller. * - * @param speed The speed to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending - * UpdateSyncGroup(). If 0, update immediately. + * @param speed The speed to set. Value should be between -1.0 and 1.0. */ - virtual void Set(float speed, uint8_t syncGroup = 0) = 0; + virtual void Set(float speed) = 0; /** * Common interface for getting the current set speed of a speed controller. * diff --git a/wpilibc/sim/include/Talon.h b/wpilibc/sim/include/Talon.h index e257235989..bcdaa211a3 100644 --- a/wpilibc/sim/include/Talon.h +++ b/wpilibc/sim/include/Talon.h @@ -18,7 +18,7 @@ class Talon : public SafePWM, public SpeedController { public: explicit Talon(uint32_t channel); virtual ~Talon() = default; - virtual void Set(float value, uint8_t syncGroup = 0); + virtual void Set(float value); virtual float Get() const; virtual void Disable(); diff --git a/wpilibc/sim/include/Victor.h b/wpilibc/sim/include/Victor.h index 8021629696..1b98816f7b 100644 --- a/wpilibc/sim/include/Victor.h +++ b/wpilibc/sim/include/Victor.h @@ -18,7 +18,7 @@ class Victor : public SafePWM, public SpeedController { public: explicit Victor(uint32_t channel); virtual ~Victor() = default; - virtual void Set(float value, uint8_t syncGroup = 0); + virtual void Set(float value); virtual float Get() const; virtual void Disable(); diff --git a/wpilibc/sim/src/Jaguar.cpp b/wpilibc/sim/src/Jaguar.cpp index 01627fec1a..e1691d1dfa 100644 --- a/wpilibc/sim/src/Jaguar.cpp +++ b/wpilibc/sim/src/Jaguar.cpp @@ -35,10 +35,9 @@ Jaguar::Jaguar(uint32_t channel) : SafePWM(channel) { * 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. - * @param syncGroup Unused interface. + * @param speed The speed value between -1.0 and 1.0 to set. */ -void Jaguar::Set(float speed, uint8_t syncGroup) { SetSpeed(speed); } +void Jaguar::Set(float speed) { SetSpeed(speed); } /** * Get the recently set value of the PWM. diff --git a/wpilibc/sim/src/RobotDrive.cpp b/wpilibc/sim/src/RobotDrive.cpp index f591b330a4..137fb58389 100644 --- a/wpilibc/sim/src/RobotDrive.cpp +++ b/wpilibc/sim/src/RobotDrive.cpp @@ -506,22 +506,14 @@ void RobotDrive::MecanumDrive_Cartesian(float x, float y, float rotation, Normalize(wheelSpeeds); - uint8_t syncGroup = 0x80; - m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * - m_invertedMotors[kFrontLeftMotor] * m_maxOutput, - syncGroup); + m_invertedMotors[kFrontLeftMotor] * m_maxOutput); m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * - m_invertedMotors[kFrontRightMotor] * m_maxOutput, - syncGroup); + m_invertedMotors[kFrontRightMotor] * m_maxOutput); m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * - m_invertedMotors[kRearLeftMotor] * m_maxOutput, - syncGroup); + m_invertedMotors[kRearLeftMotor] * m_maxOutput); m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * - m_invertedMotors[kRearRightMotor] * m_maxOutput, - syncGroup); - - // CANJaguar::UpdateSyncGroup(syncGroup); + m_invertedMotors[kRearRightMotor] * m_maxOutput); // FIXME: m_safetyHelper->Feed(); } @@ -564,22 +556,14 @@ void RobotDrive::MecanumDrive_Polar(float magnitude, float direction, Normalize(wheelSpeeds); - uint8_t syncGroup = 0x80; - m_frontLeftMotor->Set(wheelSpeeds[kFrontLeftMotor] * - m_invertedMotors[kFrontLeftMotor] * m_maxOutput, - syncGroup); + m_invertedMotors[kFrontLeftMotor] * m_maxOutput); m_frontRightMotor->Set(wheelSpeeds[kFrontRightMotor] * - m_invertedMotors[kFrontRightMotor] * m_maxOutput, - syncGroup); + m_invertedMotors[kFrontRightMotor] * m_maxOutput); m_rearLeftMotor->Set(wheelSpeeds[kRearLeftMotor] * - m_invertedMotors[kRearLeftMotor] * m_maxOutput, - syncGroup); + m_invertedMotors[kRearLeftMotor] * m_maxOutput); m_rearRightMotor->Set(wheelSpeeds[kRearRightMotor] * - m_invertedMotors[kRearRightMotor] * m_maxOutput, - syncGroup); - - // CANJaguar::UpdateSyncGroup(syncGroup); + m_invertedMotors[kRearRightMotor] * m_maxOutput); // FIXME: m_safetyHelper->Feed(); } @@ -614,25 +598,17 @@ void RobotDrive::HolonomicDrive(float magnitude, float direction, void RobotDrive::SetLeftRightMotorOutputs(float leftOutput, float rightOutput) { wpi_assert(m_rearLeftMotor != nullptr && m_rearRightMotor != nullptr); - uint8_t syncGroup = 0x80; - if (m_frontLeftMotor != nullptr) m_frontLeftMotor->Set( - Limit(leftOutput) * m_invertedMotors[kFrontLeftMotor] * m_maxOutput, - syncGroup); + Limit(leftOutput) * m_invertedMotors[kFrontLeftMotor] * m_maxOutput); m_rearLeftMotor->Set( - Limit(leftOutput) * m_invertedMotors[kRearLeftMotor] * m_maxOutput, - syncGroup); + Limit(leftOutput) * m_invertedMotors[kRearLeftMotor] * m_maxOutput); if (m_frontRightMotor != nullptr) m_frontRightMotor->Set( - -Limit(rightOutput) * m_invertedMotors[kFrontRightMotor] * m_maxOutput, - syncGroup); + -Limit(rightOutput) * m_invertedMotors[kFrontRightMotor] * m_maxOutput); m_rearRightMotor->Set( - -Limit(rightOutput) * m_invertedMotors[kRearRightMotor] * m_maxOutput, - syncGroup); - - // CANJaguar::UpdateSyncGroup(syncGroup); + -Limit(rightOutput) * m_invertedMotors[kRearRightMotor] * m_maxOutput); // FIXME: m_safetyHelper->Feed(); } diff --git a/wpilibc/sim/src/Talon.cpp b/wpilibc/sim/src/Talon.cpp index 06b8c2b782..24221125a7 100644 --- a/wpilibc/sim/src/Talon.cpp +++ b/wpilibc/sim/src/Talon.cpp @@ -40,10 +40,9 @@ Talon::Talon(uint32_t channel) : SafePWM(channel) { * 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. - * @param syncGroup Unused interface. + * @param speed The speed value between -1.0 and 1.0 to set. */ -void Talon::Set(float speed, uint8_t syncGroup) { SetSpeed(speed); } +void Talon::Set(float speed) { SetSpeed(speed); } /** * Get the recently set value of the PWM. diff --git a/wpilibc/sim/src/Victor.cpp b/wpilibc/sim/src/Victor.cpp index 905c73a3f3..571a9e0400 100644 --- a/wpilibc/sim/src/Victor.cpp +++ b/wpilibc/sim/src/Victor.cpp @@ -42,10 +42,9 @@ Victor::Victor(uint32_t channel) : SafePWM(channel) { * 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. - * @param syncGroup Unused interface. + * @param speed The speed value between -1.0 and 1.0 to set. */ -void Victor::Set(float speed, uint8_t syncGroup) { SetSpeed(speed); } +void Victor::Set(float speed) { SetSpeed(speed); } /** * Get the recently set value of the PWM. diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANJaguar.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANJaguar.java index e1b44f23a9..260a43c8bc 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANJaguar.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANJaguar.java @@ -372,7 +372,6 @@ public class CANJaguar implements MotorSafety, PIDOutput, CANSpeedController { * @param syncGroup The update group to add this set() to, pending UpdateSyncGroup(). If 0, * update immediately. */ - @Override public void set(double outputValue, byte syncGroup) { int messageID; byte[] data = new byte[8]; diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANTalon.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANTalon.java index 1af15907fc..0bb8d421a6 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANTalon.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CANTalon.java @@ -417,17 +417,6 @@ public class CANTalon implements MotorSafety, PIDOutput, PIDSource, CANSpeedCont } } - /** - * Sets the output of the Talon. - * - * @param outputValue See set(). - * @param thisValueDoesNotDoAnything corresponds to syncGroup from Jaguar; not relevant here. - */ - @Override - public void set(double outputValue, byte thisValueDoesNotDoAnything) { - set(outputValue); - } - /** * Sets the appropriate output on the talon, depending on the mode. * diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWMSpeedController.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWMSpeedController.java index 40c7ebe84d..80fd8829a8 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWMSpeedController.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWMSpeedController.java @@ -23,25 +23,6 @@ public abstract class PWMSpeedController extends SafePWM implements SpeedControl super(channel); } - /** - * 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 to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, update - * immediately. - * @deprecated For compatibility with CANJaguar - * - */ - @Deprecated - @Override - public void set(double speed, byte syncGroup) { - setSpeed(m_isInverted ? -speed : speed); - Feed(); - } - /** * Set the PWM value. * diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/RobotDrive.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/RobotDrive.java index fe3545acaa..912c891ff1 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/RobotDrive.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/RobotDrive.java @@ -72,7 +72,6 @@ public class RobotDrive implements MotorSafety { protected SpeedController m_rearLeftMotor; protected SpeedController m_rearRightMotor; protected boolean m_allocatedSpeedControllers; - protected byte m_syncGroup = 0; protected static boolean kArcadeRatioCurve_Reported = false; protected static boolean kTank_Reported = false; protected static boolean kArcadeStandard_Reported = false; @@ -503,14 +502,10 @@ public class RobotDrive implements MotorSafety { wheelSpeeds[MotorType.kRearRight_val] = xIn + yIn - rotation; normalize(wheelSpeeds); - m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_maxOutput, m_syncGroup); - m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_maxOutput, m_syncGroup); - m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_maxOutput, m_syncGroup); - m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_maxOutput, m_syncGroup); - - if (m_syncGroup != 0) { - CANJaguar.updateSyncGroup(m_syncGroup); - } + m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_maxOutput); + m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_maxOutput); + m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_maxOutput); + m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_maxOutput); if (m_safetyHelper != null) { m_safetyHelper.feed(); @@ -551,14 +546,10 @@ public class RobotDrive implements MotorSafety { normalize(wheelSpeeds); - m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_maxOutput, m_syncGroup); - m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_maxOutput, m_syncGroup); - m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_maxOutput, m_syncGroup); - m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_maxOutput, m_syncGroup); - - if (m_syncGroup != 0) { - CANJaguar.updateSyncGroup(m_syncGroup); - } + m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_maxOutput); + m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_maxOutput); + m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_maxOutput); + m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_maxOutput); if (m_safetyHelper != null) { m_safetyHelper.feed(); @@ -594,18 +585,14 @@ public class RobotDrive implements MotorSafety { } if (m_frontLeftMotor != null) { - m_frontLeftMotor.set(limit(leftOutput) * m_maxOutput, m_syncGroup); + m_frontLeftMotor.set(limit(leftOutput) * m_maxOutput); } - m_rearLeftMotor.set(limit(leftOutput) * m_maxOutput, m_syncGroup); + m_rearLeftMotor.set(limit(leftOutput) * m_maxOutput); if (m_frontRightMotor != null) { - m_frontRightMotor.set(-limit(rightOutput) * m_maxOutput, m_syncGroup); - } - m_rearRightMotor.set(-limit(rightOutput) * m_maxOutput, m_syncGroup); - - if (m_syncGroup != 0) { - CANJaguar.updateSyncGroup(m_syncGroup); + m_frontRightMotor.set(-limit(rightOutput) * m_maxOutput); } + m_rearRightMotor.set(-limit(rightOutput) * m_maxOutput); if (m_safetyHelper != null) { m_safetyHelper.feed(); @@ -704,17 +691,6 @@ public class RobotDrive implements MotorSafety { m_maxOutput = maxOutput; } - /** - * Set the number of the sync group for the motor controllers. If the motor controllers are {@link - * CANJaguar}s, then they will all be added to this sync group, causing them to update their - * values at the same time. - * - * @param syncGroup the update group to add the motor controllers to - */ - public void setCANJaguarSyncGroup(byte syncGroup) { - m_syncGroup = syncGroup; - } - /** * Free the speed controllers if they were allocated locally. */ diff --git a/wpilibj/src/shared/java/edu/wpi/first/wpilibj/SpeedController.java b/wpilibj/src/shared/java/edu/wpi/first/wpilibj/SpeedController.java index 65c902f065..9c71038d28 100644 --- a/wpilibj/src/shared/java/edu/wpi/first/wpilibj/SpeedController.java +++ b/wpilibj/src/shared/java/edu/wpi/first/wpilibj/SpeedController.java @@ -19,15 +19,6 @@ public interface SpeedController extends PIDOutput { */ double get(); - /** - * Common interface for setting the speed of a speed controller. - * - * @param speed The speed to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, update - * immediately. - */ - void set(double speed, byte syncGroup); - /** * Common interface for setting the speed of a speed controller. * diff --git a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Jaguar.java b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Jaguar.java index b2b41a2ed9..1cab5ce47e 100644 --- a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Jaguar.java +++ b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Jaguar.java @@ -43,22 +43,6 @@ public class Jaguar implements SpeedController, PIDOutput, MotorSafety, LiveWind initJaguar(channel); } - /** - * Set the PWM value. - * - * @param speed The speed to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, - * update immediately. - * @deprecated For compatibility with CANJaguar - * - * The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the value for the - * FPGA. - */ - @Deprecated - public void set(double speed, byte syncGroup) { - impl.set(speed, syncGroup); - } - /** * Set the PWM value. * diff --git a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/RobotDrive.java b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/RobotDrive.java index 4f8716fe39..68e83a0ba9 100644 --- a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/RobotDrive.java +++ b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/RobotDrive.java @@ -504,16 +504,14 @@ public class RobotDrive implements MotorSafety { normalize(wheelSpeeds); - byte syncGroup = (byte) 0x80; - m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_invertedMotors[MotorType - .kFrontLeft_val] * m_maxOutput, syncGroup); + .kFrontLeft_val] * m_maxOutput); m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_invertedMotors[MotorType - .kFrontRight_val] * m_maxOutput, syncGroup); + .kFrontRight_val] * m_maxOutput); m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_invertedMotors[MotorType - .kRearLeft_val] * m_maxOutput, syncGroup); + .kRearLeft_val] * m_maxOutput); m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_invertedMotors[MotorType - .kRearRight_val] * m_maxOutput, syncGroup); + .kRearRight_val] * m_maxOutput); if (m_safetyHelper != null) m_safetyHelper.feed(); } @@ -551,16 +549,14 @@ public class RobotDrive implements MotorSafety { normalize(wheelSpeeds); - byte syncGroup = (byte) 0x80; - m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_invertedMotors[MotorType - .kFrontLeft_val] * m_maxOutput, syncGroup); + .kFrontLeft_val] * m_maxOutput); m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_invertedMotors[MotorType - .kFrontRight_val] * m_maxOutput, syncGroup); + .kFrontRight_val] * m_maxOutput); m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_invertedMotors[MotorType - .kRearLeft_val] * m_maxOutput, syncGroup); + .kRearLeft_val] * m_maxOutput); m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_invertedMotors[MotorType - .kRearRight_val] * m_maxOutput, syncGroup); + .kRearRight_val] * m_maxOutput); if (m_safetyHelper != null) m_safetyHelper.feed(); } @@ -593,21 +589,19 @@ public class RobotDrive implements MotorSafety { throw new NullPointerException("Null motor provided"); } - byte syncGroup = (byte) 0x80; - if (m_frontLeftMotor != null) { m_frontLeftMotor.set(limit(leftOutput) * m_invertedMotors[MotorType.kFrontLeft_val] * - m_maxOutput, syncGroup); + m_maxOutput); } m_rearLeftMotor.set(limit(leftOutput) * m_invertedMotors[MotorType.kRearLeft_val] * - m_maxOutput, syncGroup); + m_maxOutput); if (m_frontRightMotor != null) { m_frontRightMotor.set(-limit(rightOutput) * m_invertedMotors[MotorType.kFrontRight_val] * - m_maxOutput, syncGroup); + m_maxOutput); } m_rearRightMotor.set(-limit(rightOutput) * m_invertedMotors[MotorType.kRearRight_val] * - m_maxOutput, syncGroup); + m_maxOutput); if (m_safetyHelper != null) m_safetyHelper.feed(); } diff --git a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Servo.java b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Servo.java index 88774b0dc8..358cd4c1d1 100644 --- a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Servo.java +++ b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Servo.java @@ -41,20 +41,6 @@ public class Servo implements SpeedController, LiveWindowSendable { impl = new SimSpeedController("simulator/pwm/" + channel); } - /** - * Set the PWM value. - * - * @param speed The speed to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, - * update immediately. - * @deprecated The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the value - * for the FPGA. - */ - @Deprecated - public void set(double speed, byte syncGroup) { - impl.set(speed, syncGroup); - } - /** * Write out the PID value as seen in the PIDOutput base object. * diff --git a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/SpeedController.java b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/SpeedController.java index 17402abe1a..71e397f3cb 100644 --- a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/SpeedController.java +++ b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/SpeedController.java @@ -19,15 +19,6 @@ public interface SpeedController extends PIDOutput { */ double get(); - /** - * Common interface for setting the speed of a speed controller. - * - * @param speed The speed to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, - * update immediately. - */ - void set(double speed, byte syncGroup); - /** * Common interface for setting the speed of a speed controller. * diff --git a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Talon.java b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Talon.java index ef14c82af1..fdb497249c 100644 --- a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Talon.java +++ b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Talon.java @@ -53,22 +53,6 @@ public class Talon implements SpeedController, PIDOutput, MotorSafety, LiveWindo initTalon(channel); } - /** - * 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 to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, - * update immediately. - * @deprecated For compatibility with CANJaguar - */ - @Deprecated - public void set(double speed, byte syncGroup) { - m_impl.set(speed, syncGroup); - } - /** * Set the PWM value. * diff --git a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Victor.java b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Victor.java index 3ff9a0f3a2..6ea2931ac0 100644 --- a/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Victor.java +++ b/wpilibj/src/sim/java/edu/wpi/first/wpilibj/Victor.java @@ -55,22 +55,6 @@ public class Victor implements SpeedController, PIDOutput, MotorSafety, LiveWind initVictor(channel); } - /** - * 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 to set. Value should be between -1.0 and 1.0. - * @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, - * update immediately. - * @deprecated For compatibility with CANJaguar. - */ - @Deprecated - public void set(double speed, byte syncGroup) { - m_impl.set(speed, syncGroup); - } - /** * Set the PWM value. *