updated pid values and added setpoint

This commit is contained in:
Adam Long 2016-09-12 15:01:15 -04:00
parent 18ff5daaad
commit 0108b984b1
2 changed files with 10 additions and 4 deletions

View File

@ -15,6 +15,7 @@ public class Robot extends IterativeRobot {
oi = new OI(); oi = new OI();
chooser = new SendableChooser(); chooser = new SendableChooser();
SmartDashboard.putData("Auto mode", chooser); SmartDashboard.putData("Auto mode", chooser);
SmartDashboard.putData("MainArm",CommandBase.mainArm.getPIDController());
} }
public void disabledInit() { public void disabledInit() {
} }
@ -39,6 +40,7 @@ public class Robot extends IterativeRobot {
Scheduler.getInstance().run(); Scheduler.getInstance().run();
SmartDashboard.putNumber("ArmAngleRaw",CommandBase.mainArm.getRaw()); SmartDashboard.putNumber("ArmAngleRaw",CommandBase.mainArm.getRaw());
SmartDashboard.putNumber("ArmAngleDegrees",CommandBase.mainArm.getDegrees()); SmartDashboard.putNumber("ArmAngleDegrees",CommandBase.mainArm.getDegrees());
System.out.println(CommandBase.mainArm.getDegrees());
} }
public void testPeriodic() { public void testPeriodic() {
LiveWindow.run(); LiveWindow.run();

View File

@ -9,19 +9,23 @@ public class MainArm extends PIDSubsystem {
CANTalon armMotorRight = new CANTalon(RobotMap.armRightMotor); CANTalon armMotorRight = new CANTalon(RobotMap.armRightMotor);
AnalogInput pot = new AnalogInput(RobotMap.armPot); AnalogInput pot = new AnalogInput(RobotMap.armPot);
public MainArm(){ public MainArm(){
super("MainArm",0.0,0.0,0.0); super("MainArm",0.06,0.0,0.002);
getPIDController().setContinuous(false); getPIDController().setContinuous(false);
//setSetpoint(15);
enable();
} }
public void initDefaultCommand() { public void initDefaultCommand() {
} }
public void moveArm(double speed){ public void moveArm(double speed){
armMotorLeft.set(speed); armMotorLeft.set(-speed);
armMotorRight.set(-speed); armMotorRight.set(speed);
} }
protected double returnPIDInput(){ protected double returnPIDInput(){
return pot.getAverageVoltage(); return getDegrees();
} }
protected void usePIDOutput(double output){ protected void usePIDOutput(double output){
armMotorLeft.set(-output);
armMotorRight.set(output);
} }
public double getRaw(){ public double getRaw(){
return pot.getAverageVoltage(); return pot.getAverageVoltage();