mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
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.
This commit is contained in:
committed by
Peter Johnson
parent
e842ff7ad5
commit
9e99df1cf7
@@ -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];
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -23,25 +23,6 @@ public abstract class PWMSpeedController extends SafePWM implements SpeedControl
|
||||
super(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the PWM value.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user