mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Added tests for motor inversions.
This commit squashes all of Patrick's eleven commits into one so that things are a bit more sane. The original commit messages and change ids (for gerrit) can be found below. Testing Motor Inversion Feature (Java tests only so far) Change-Id: I44cd9b5a3fe066e1071316831dde14bff5ec3bd9 Test 2 of java testing for Motor Inverting Change-Id: I96cc0534bb1d28a70d10c582f0b40ea3a2d83cab Added another test to try to track down issue with InvertingMotor jaguar and Talon Change-Id: I9b5292315c93ec0d568d53a6bcdac5b998a6d857 More Testing on the Inverting motors with jaguars and talons. Change-Id: I896210a54903e3c0af68e8c41360c165cf9c3122 Added C++ integration Tests for the motor inversion. Change-Id: I81af5d4aab78d755340d99608b838046bf7ddda1 C++ tests for Motor Inversion now without crashing Change-Id: Ifdecdbfc1aeb18aafb2b4c63709b27636074a274 More testing of inverted motors (now with c++ tests) Talon seems not to be working on test rig Also added a CANJaguartest file in java since was missing Currently porting the CANJaguar tests from c++ to java Change-Id: Ib578d6ee1256ac31ddf20603aa6f24adde08065b Another attempt at adding java tests for can jaguar inversion. Change-Id: I971a886a4e555ada5bd15a814094da2a1eb5c8e1 Minor changes and attempt to rerun tests after yesterday's jenkins crash. Change-Id: I7ed0904d4243499c3246e9c39e5493d0d9c962c5 All motor inversion tests should be working now. Talon on the test rig has been fixed. Change-Id: I20bd6d7486b758ce1ce47ac799150475b3152b6f Updated Inversion tests again. Should work this time. (worked on the test rig prior) Change-Id: Ifdf222d5e5733fe802f29e7d939b72e84972e8da Added tests for motor inversions. This commit squashes all of Patrick's eleven commits into one so that things are a bit more sane. The original commit messages and change ids (for gerrit) can be found below. Testing Motor Inversion Feature (Java tests only so far) Change-Id: I44cd9b5a3fe066e1071316831dde14bff5ec3bd9 Test 2 of java testing for Motor Inverting Change-Id: I96cc0534bb1d28a70d10c582f0b40ea3a2d83cab Added another test to try to track down issue with InvertingMotor jaguar and Talon Change-Id: I9b5292315c93ec0d568d53a6bcdac5b998a6d857 More Testing on the Inverting motors with jaguars and talons. Change-Id: I896210a54903e3c0af68e8c41360c165cf9c3122 Added C++ integration Tests for the motor inversion. Change-Id: I81af5d4aab78d755340d99608b838046bf7ddda1 C++ tests for Motor Inversion now without crashing Change-Id: Ifdecdbfc1aeb18aafb2b4c63709b27636074a274 More testing of inverted motors (now with c++ tests) Talon seems not to be working on test rig Also added a CANJaguartest file in java since was missing Currently porting the CANJaguar tests from c++ to java Change-Id: Ib578d6ee1256ac31ddf20603aa6f24adde08065b Another attempt at adding java tests for can jaguar inversion. Change-Id: I971a886a4e555ada5bd15a814094da2a1eb5c8e1 Minor changes and attempt to rerun tests after yesterday's jenkins crash. Change-Id: I7ed0904d4243499c3246e9c39e5493d0d9c962c5 All motor inversion tests should be working now. Talon on the test rig has been fixed. Change-Id: I20bd6d7486b758ce1ce47ac799150475b3152b6f Updated Inversion tests again. Should work this time. (worked on the test rig prior) Change-Id: Ifdf222d5e5733fe802f29e7d939b72e84972e8da
This commit is contained in:
@@ -50,7 +50,7 @@ public class CANJaguar implements MotorSafety, PIDOutput, PIDInterface, CANSpeed
|
||||
/** Sets a potentiometer as the position reference only. <br> Passed as the "tag" when setting the control mode. */
|
||||
public final static PotentiometerTag kPotentiometer = new PotentiometerTag();
|
||||
|
||||
|
||||
private boolean isInverted = false;
|
||||
/**
|
||||
* Mode determines how the Jaguar is controlled, used internally.
|
||||
*/
|
||||
@@ -348,12 +348,12 @@ public class CANJaguar implements MotorSafety, PIDOutput, PIDInterface, CANSpeed
|
||||
switch(m_controlMode) {
|
||||
case PercentVbus:
|
||||
messageID = CANJNI.LM_API_VOLT_T_SET;
|
||||
dataSize = packPercentage(data, outputValue);
|
||||
dataSize = packPercentage(data, isInverted ? -outputValue: outputValue);
|
||||
break;
|
||||
|
||||
case Speed:
|
||||
messageID = CANJNI.LM_API_SPD_T_SET;
|
||||
dataSize = packFXP16_16(data, outputValue);
|
||||
dataSize = packFXP16_16(data, isInverted ? -outputValue: outputValue);
|
||||
break;
|
||||
|
||||
case Position:
|
||||
@@ -369,7 +369,7 @@ public class CANJaguar implements MotorSafety, PIDOutput, PIDInterface, CANSpeed
|
||||
|
||||
case Voltage:
|
||||
messageID = CANJNI.LM_API_VCOMP_T_SET;
|
||||
dataSize = packFXP8_8(data, outputValue);
|
||||
dataSize = packFXP8_8(data, isInverted ? -outputValue: outputValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -422,7 +422,17 @@ public class CANJaguar implements MotorSafety, PIDOutput, PIDInterface, CANSpeed
|
||||
disableControl();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Inverts the direction of rotation of the motor
|
||||
* Only works in percentVbus, Speed, and Voltage mode
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
@Override
|
||||
public void setInverted(boolean isInverted) {
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all unverified params and make sure they're equal to their local
|
||||
* cached versions. If a value isn't available, it gets requested. If a value
|
||||
* doesn't match up, it gets set again.
|
||||
|
||||
@@ -14,6 +14,7 @@ import edu.wpi.first.wpilibj.tables.ITableListener;
|
||||
|
||||
public class CANTalon implements MotorSafety, PIDOutput, PIDSource, PIDInterface, CANSpeedController, LiveWindowSendable {
|
||||
private MotorSafetyHelper m_safetyHelper;
|
||||
private boolean isInverted = false;
|
||||
public enum TalonControlMode {
|
||||
PercentVbus(0), Follower(5), Voltage(4), Position(1), Speed(2), Current(3), Disabled(15);
|
||||
|
||||
@@ -144,18 +145,18 @@ public class CANTalon implements MotorSafety, PIDOutput, PIDSource, PIDInterface
|
||||
m_setPoint = outputValue;
|
||||
switch (m_controlMode) {
|
||||
case PercentVbus:
|
||||
m_impl.Set(outputValue);
|
||||
m_impl.Set(isInverted ? -outputValue: outputValue);
|
||||
break;
|
||||
case Follower:
|
||||
m_impl.SetDemand((int)outputValue);
|
||||
break;
|
||||
case Voltage:
|
||||
// Voltage is an 8.8 fixed point number.
|
||||
int volts = (int)(outputValue * 256);
|
||||
int volts = (int)((isInverted ? -outputValue: outputValue) * 256);
|
||||
m_impl.SetDemand(volts);
|
||||
break;
|
||||
case Speed:
|
||||
m_impl.SetDemand((int)outputValue);
|
||||
m_impl.SetDemand((int)(isInverted ? -outputValue: outputValue));
|
||||
break;
|
||||
case Position:
|
||||
m_impl.SetDemand((int)outputValue);
|
||||
@@ -167,7 +168,18 @@ public class CANTalon implements MotorSafety, PIDOutput, PIDSource, PIDInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Inverts the direction of the motor's rotation
|
||||
* Only works in PercentVbus mode
|
||||
*
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
@Override
|
||||
public void setInverted(boolean isInverted) {
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the output of the Talon.
|
||||
*
|
||||
* @param outputValue See set().
|
||||
|
||||
@@ -16,7 +16,7 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
* @see CANJaguar CANJaguar for CAN control
|
||||
*/
|
||||
public class Jaguar extends SafePWM implements SpeedController {
|
||||
|
||||
private boolean isInverted = false;
|
||||
/**
|
||||
* Common initialization code called by all constructors.
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ public class Jaguar extends SafePWM implements SpeedController {
|
||||
@Deprecated
|
||||
@Override
|
||||
public void set(double speed, byte syncGroup) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
@@ -77,10 +77,20 @@ public class Jaguar extends SafePWM implements SpeedController {
|
||||
*/
|
||||
@Override
|
||||
public void set(double speed) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Common interface for inverting direction of a speed controller
|
||||
*
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
@Override
|
||||
public void setInverted(boolean isInverted) {
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
*
|
||||
|
||||
@@ -60,7 +60,6 @@ public class RobotDrive implements MotorSafety {
|
||||
public static final double kDefaultSensitivity = 0.5;
|
||||
public static final double kDefaultMaxOutput = 1.0;
|
||||
protected static final int kMaxNumberOfMotors = 4;
|
||||
protected final int m_invertedMotors[] = new int[4];
|
||||
protected double m_sensitivity;
|
||||
protected double m_maxOutput;
|
||||
protected SpeedController m_frontLeftMotor;
|
||||
@@ -89,9 +88,6 @@ public class RobotDrive implements MotorSafety {
|
||||
m_rearLeftMotor = new Talon(leftMotorChannel);
|
||||
m_frontRightMotor = null;
|
||||
m_rearRightMotor = new Talon(rightMotorChannel);
|
||||
for (int i = 0; i < kMaxNumberOfMotors; i++) {
|
||||
m_invertedMotors[i] = 1;
|
||||
}
|
||||
m_allocatedSpeedControllers = true;
|
||||
setupMotorSafety();
|
||||
drive(0, 0);
|
||||
@@ -115,9 +111,6 @@ public class RobotDrive implements MotorSafety {
|
||||
m_rearRightMotor = new Talon(rearRightMotor);
|
||||
m_frontLeftMotor = new Talon(frontLeftMotor);
|
||||
m_frontRightMotor = new Talon(frontRightMotor);
|
||||
for (int i = 0; i < kMaxNumberOfMotors; i++) {
|
||||
m_invertedMotors[i] = 1;
|
||||
}
|
||||
m_allocatedSpeedControllers = true;
|
||||
setupMotorSafety();
|
||||
drive(0, 0);
|
||||
@@ -142,9 +135,6 @@ public class RobotDrive implements MotorSafety {
|
||||
m_rearRightMotor = rightMotor;
|
||||
m_sensitivity = kDefaultSensitivity;
|
||||
m_maxOutput = kDefaultMaxOutput;
|
||||
for (int i = 0; i < kMaxNumberOfMotors; i++) {
|
||||
m_invertedMotors[i] = 1;
|
||||
}
|
||||
m_allocatedSpeedControllers = false;
|
||||
setupMotorSafety();
|
||||
drive(0, 0);
|
||||
@@ -169,10 +159,6 @@ public class RobotDrive implements MotorSafety {
|
||||
m_frontRightMotor = frontRightMotor;
|
||||
m_rearRightMotor = rearRightMotor;
|
||||
m_sensitivity = kDefaultSensitivity;
|
||||
m_maxOutput = kDefaultMaxOutput;
|
||||
for (int i = 0; i < kMaxNumberOfMotors; i++) {
|
||||
m_invertedMotors[i] = 1;
|
||||
}
|
||||
m_allocatedSpeedControllers = false;
|
||||
setupMotorSafety();
|
||||
drive(0, 0);
|
||||
@@ -487,10 +473,10 @@ public class RobotDrive implements MotorSafety {
|
||||
wheelSpeeds[MotorType.kRearRight_val] = xIn + yIn - rotation;
|
||||
|
||||
normalize(wheelSpeeds);
|
||||
m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_invertedMotors[MotorType.kFrontLeft_val] * m_maxOutput, m_syncGroup);
|
||||
m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_invertedMotors[MotorType.kFrontRight_val] * m_maxOutput, m_syncGroup);
|
||||
m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_invertedMotors[MotorType.kRearLeft_val] * m_maxOutput, m_syncGroup);
|
||||
m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_invertedMotors[MotorType.kRearRight_val] * m_maxOutput, m_syncGroup);
|
||||
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);
|
||||
@@ -533,10 +519,10 @@ public class RobotDrive implements MotorSafety {
|
||||
|
||||
normalize(wheelSpeeds);
|
||||
|
||||
m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft_val] * m_invertedMotors[MotorType.kFrontLeft_val] * m_maxOutput, m_syncGroup);
|
||||
m_frontRightMotor.set(wheelSpeeds[MotorType.kFrontRight_val] * m_invertedMotors[MotorType.kFrontRight_val] * m_maxOutput, m_syncGroup);
|
||||
m_rearLeftMotor.set(wheelSpeeds[MotorType.kRearLeft_val] * m_invertedMotors[MotorType.kRearLeft_val] * m_maxOutput, m_syncGroup);
|
||||
m_rearRightMotor.set(wheelSpeeds[MotorType.kRearRight_val] * m_invertedMotors[MotorType.kRearRight_val] * m_maxOutput, m_syncGroup);
|
||||
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 (this.m_syncGroup != 0) {
|
||||
CANJaguar.updateSyncGroup(m_syncGroup);
|
||||
@@ -573,14 +559,14 @@ public class RobotDrive implements MotorSafety {
|
||||
}
|
||||
|
||||
if (m_frontLeftMotor != null) {
|
||||
m_frontLeftMotor.set(limit(leftOutput) * m_invertedMotors[MotorType.kFrontLeft_val] * m_maxOutput, m_syncGroup);
|
||||
m_frontLeftMotor.set(limit(leftOutput) * m_maxOutput, m_syncGroup);
|
||||
}
|
||||
m_rearLeftMotor.set(limit(leftOutput) * m_invertedMotors[MotorType.kRearLeft_val] * m_maxOutput, m_syncGroup);
|
||||
m_rearLeftMotor.set(limit(leftOutput) * m_maxOutput, m_syncGroup);
|
||||
|
||||
if (m_frontRightMotor != null) {
|
||||
m_frontRightMotor.set(-limit(rightOutput) * m_invertedMotors[MotorType.kFrontRight_val] * m_maxOutput, m_syncGroup);
|
||||
m_frontRightMotor.set(-limit(rightOutput) * m_maxOutput, m_syncGroup);
|
||||
}
|
||||
m_rearRightMotor.set(-limit(rightOutput) * m_invertedMotors[MotorType.kRearRight_val] * m_maxOutput, m_syncGroup);
|
||||
m_rearRightMotor.set(-limit(rightOutput) * m_maxOutput, m_syncGroup);
|
||||
|
||||
if (this.m_syncGroup != 0) {
|
||||
CANJaguar.updateSyncGroup(m_syncGroup);
|
||||
@@ -640,9 +626,13 @@ public class RobotDrive implements MotorSafety {
|
||||
* @param isInverted True if the motor should be inverted when operated.
|
||||
*/
|
||||
public void setInvertedMotor(MotorType motor, boolean isInverted) {
|
||||
m_invertedMotors[motor.value] = isInverted ? -1 : 1;
|
||||
switch (motor.value){
|
||||
case MotorType.kFrontLeft_val: m_frontLeftMotor.setInverted(isInverted); break;
|
||||
case MotorType.kFrontRight_val: m_frontRightMotor.setInverted(isInverted); break;
|
||||
case MotorType.kRearLeft_val: m_rearLeftMotor.setInverted(isInverted); break;
|
||||
case MotorType.kRearRight_val: m_rearRightMotor.setInverted(isInverted); break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the turning sensitivity.
|
||||
*
|
||||
|
||||
@@ -34,6 +34,12 @@ public interface SpeedController extends PIDOutput {
|
||||
*/
|
||||
void set(double speed);
|
||||
|
||||
/**
|
||||
* Common interface for inverting direction of a speed controller
|
||||
*
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
void setInverted(boolean isInverted);
|
||||
/**
|
||||
* Disable the speed controller
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
* Cross the Road Electronics (CTRE) Talon and Talon SR Speed Controller
|
||||
*/
|
||||
public class Talon extends SafePWM implements SpeedController {
|
||||
|
||||
private boolean isInverted = false;
|
||||
/**
|
||||
* Common initialization code called by all constructors.
|
||||
*
|
||||
@@ -62,10 +62,11 @@ public class Talon extends SafePWM implements SpeedController {
|
||||
* @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, update immediately.
|
||||
*/
|
||||
public void set(double speed, byte syncGroup) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the PWM value.
|
||||
*
|
||||
@@ -75,9 +76,18 @@ public class Talon extends SafePWM implements SpeedController {
|
||||
* @param speed The speed value between -1.0 and 1.0 to set.
|
||||
*/
|
||||
public void set(double speed) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
/**
|
||||
* Common interface for inverting direction of a speed controller
|
||||
*
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
@Override
|
||||
public void setInverted(boolean isInverted) {
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
|
||||
@@ -16,7 +16,7 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
* @see CANTalon CANTalon for CAN control of Talon SRX
|
||||
*/
|
||||
public class TalonSRX extends SafePWM implements SpeedController {
|
||||
|
||||
private boolean isInverted = false;
|
||||
/**
|
||||
* Common initialization code called by all constructors.
|
||||
*
|
||||
@@ -63,7 +63,7 @@ public class TalonSRX extends SafePWM implements SpeedController {
|
||||
* @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, update immediately.
|
||||
*/
|
||||
public void set(double speed, byte syncGroup) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
@@ -76,10 +76,20 @@ public class TalonSRX extends SafePWM implements SpeedController {
|
||||
* @param speed The speed value between -1.0 and 1.0 to set.
|
||||
*/
|
||||
public void set(double speed) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Common interface for inverting direction of a speed controller
|
||||
*
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
@Override
|
||||
public void setInverted(boolean isInverted) {
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
*
|
||||
|
||||
@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
* class but may need to be calibrated per the Victor 884 user manual.
|
||||
*/
|
||||
public class Victor extends SafePWM implements SpeedController {
|
||||
|
||||
private boolean isInverted = false;
|
||||
/**
|
||||
* Common initialization code called by all constructors.
|
||||
*
|
||||
@@ -67,7 +67,7 @@ public class Victor extends SafePWM implements SpeedController {
|
||||
* @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, update immediately.
|
||||
*/
|
||||
public void set(double speed, byte syncGroup) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
@@ -80,10 +80,20 @@ public class Victor extends SafePWM implements SpeedController {
|
||||
* @param speed The speed value between -1.0 and 1.0 to set.
|
||||
*/
|
||||
public void set(double speed) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Common interface for inverting direction of a speed controller
|
||||
*
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
@Override
|
||||
public void setInverted(boolean isInverted) {
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
*
|
||||
|
||||
@@ -15,7 +15,7 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
* VEX Robotics Victor SP Speed Controller
|
||||
*/
|
||||
public class VictorSP extends SafePWM implements SpeedController {
|
||||
|
||||
private boolean isInverted = false;
|
||||
/**
|
||||
* Common initialization code called by all constructors.
|
||||
*
|
||||
@@ -62,7 +62,7 @@ public class VictorSP extends SafePWM implements SpeedController {
|
||||
* @param syncGroup The update group to add this Set() to, pending UpdateSyncGroup(). If 0, update immediately.
|
||||
*/
|
||||
public void set(double speed, byte syncGroup) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
@@ -75,10 +75,20 @@ public class VictorSP extends SafePWM implements SpeedController {
|
||||
* @param speed The speed value between -1.0 and 1.0 to set.
|
||||
*/
|
||||
public void set(double speed) {
|
||||
setSpeed(speed);
|
||||
setSpeed(isInverted ? -speed: speed);
|
||||
Feed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Common interface for inverting direction of a speed controller
|
||||
*
|
||||
* @param isInverted The state of inversion true is inverted
|
||||
*/
|
||||
@Override
|
||||
public void setInverted(boolean isInverted) {
|
||||
this.isInverted = isInverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recently set value of the PWM.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user