Merge changes If51bf61d,Ia6f4997b

* changes:
  Added Omar's new CanTalonSRX code.
  Added nicer Java interface for Talon SRX -- throttle mode works.
This commit is contained in:
Brad Miller (WPI)
2014-11-26 12:53:44 -08:00
committed by Gerrit Code Review
25 changed files with 3769 additions and 270 deletions

View File

@@ -2,7 +2,7 @@ package $package;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.hal.CanTalonSRX;
import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.Timer;
@@ -13,27 +13,27 @@ import edu.wpi.first.wpilibj.Timer;
*/
public class Robot extends SampleRobot {
CanTalonSRX motor;
CANTalon motor;
private final double k_updatePeriod = 0.005; // update every 0.005 seconds/5 milliseconds (200Hz)
public Robot() {
motor = new CanTalonSRX(1); // Initialize the CanTalonSRX on device 1.
motor = new CANTalon(1); // Initialize the CanTalonSRX on device 1.
}
/**
* Runs the motor from a joystick.
*/
public void operatorControl() {
motor.SetModeSelect(0);
motor.enableControl();
while (isOperatorControl() && isEnabled()) {
// Set the motor's output.
// Set the motor's output to half power.
// This takes a number from -1 (100% speed in reverse) to +1 (100% speed
// going forward)
motor.Set(0.5);
motor.set(0.5);
Timer.delay(k_updatePeriod); // wait 5ms to the next update
}
motor.Set(0.0);
motor.disable();
}
}