diff --git a/Robot2018/lib/User_Libraries.properties b/Robot2018/lib/User_Libraries.properties index dacc870..0e4f44a 100644 --- a/Robot2018/lib/User_Libraries.properties +++ b/Robot2018/lib/User_Libraries.properties @@ -1,2 +1,2 @@ -#Sun Feb 18 11:01:27 PST 2018 +#Sun Feb 18 15:40:25 PST 2018 C\:\\Users\\dean\\git\\RobotCode2018\\Robot2018\\lib\\libpathfinderjava.so=4087ee38c338446b8305f67716260df4 diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java b/Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java index eadacd8..1d7b7b5 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java +++ b/Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java @@ -7,14 +7,8 @@ package org.usfirst.frc.team199.Robot2018; -import org.usfirst.frc.team199.Robot2018.commands.CloseIntake; -import org.usfirst.frc.team199.Robot2018.commands.IntakeCube; -import org.usfirst.frc.team199.Robot2018.commands.LowerIntake; -import org.usfirst.frc.team199.Robot2018.commands.OpenIntake; -import org.usfirst.frc.team199.Robot2018.commands.OutakeCube; import org.usfirst.frc.team199.Robot2018.commands.PIDMove; import org.usfirst.frc.team199.Robot2018.commands.PIDTurn; -import org.usfirst.frc.team199.Robot2018.commands.RaiseIntake; import org.usfirst.frc.team199.Robot2018.commands.ResetEncoders; import org.usfirst.frc.team199.Robot2018.commands.RunLift; import org.usfirst.frc.team199.Robot2018.commands.SetDistancePerPulse; @@ -92,18 +86,22 @@ public OI() { MoveLiftUpButton.whileHeld(new RunLift(Robot.lift, true)); MoveLiftDownButton.whileHeld(new RunLift(Robot.lift, false)); - manipulator = new Joystick(2); - closeIntake = new JoystickButton(manipulator, getButton("Close Intake Button", 1)); - closeIntake.whenPressed(new CloseIntake()); - openIntake = new JoystickButton(manipulator, getButton("Open Intake Button", 2)); - openIntake.whenPressed(new OpenIntake()); - raiseIntake = new JoystickButton(manipulator, getButton("Raise Intake Button", 3)); - raiseIntake.whenPressed(new RaiseIntake()); - lowerIntake = new JoystickButton(manipulator, getButton("Lower Intake Button", 4)); - lowerIntake.whenPressed(new LowerIntake()); - intake = new JoystickButton(manipulator, getButton("Intake Button", 5)); - intake.whenPressed(new IntakeCube()); - outake = new JoystickButton(manipulator, getButton("Outake Button", 6)); - outake.whenPressed(new OutakeCube()); + // manipulator = new Joystick(2); + // closeIntake = new JoystickButton(manipulator, getButton("Close Intake + // Button", 1)); + // closeIntake.whenPressed(new CloseIntake()); + // openIntake = new JoystickButton(manipulator, getButton("Open Intake Button", + // 2)); + // openIntake.whenPressed(new OpenIntake()); + // raiseIntake = new JoystickButton(manipulator, getButton("Raise Intake + // Button", 3)); + // raiseIntake.whenPressed(new RaiseIntake()); + // lowerIntake = new JoystickButton(manipulator, getButton("Lower Intake + // Button", 4)); + // lowerIntake.whenPressed(new LowerIntake()); + // intake = new JoystickButton(manipulator, getButton("Intake Button", 5)); + // intake.whenPressed(new IntakeCube()); + // outake = new JoystickButton(manipulator, getButton("Outake Button", 6)); + // outake.whenPressed(new OutakeCube()); } } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java b/Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java index 450766d..5c21509 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java +++ b/Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java @@ -212,7 +212,7 @@ public void teleopPeriodic() { // SmartDashboard.putNumber("Right Enc Dist", dt.getRightDist()); // SmartDashboard.putNumber("Avg Enc Dist", dt.getEncAvgDist()); // - // SmartDashboard.putNumber("Angle", dt.getAHRSAngle()); + SmartDashboard.putNumber("Angle", dt.getAHRSAngle()); } boolean firstTime = true; diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java b/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java index bc6d6c9..11ab9da 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java +++ b/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java @@ -46,6 +46,7 @@ public PIDMove(double targ, DrivetrainInterface dt, SmartDashboardInterface sd, double kf = 1 / (dt.getCurrentMaxSpeed() * sd.getConst("Default PID Update Time", 0.05)); moveController = new PIDController(sd.getConst("MovekP", 0.1), sd.getConst("MovekI", 0), sd.getConst("MovekD", 0), kf, avg, this); + SmartDashboard.putData("Move PID", moveController); } /** @@ -64,8 +65,6 @@ public void initialize() { moveController.setAbsoluteTolerance(Robot.getConst("MoveTolerance", 0.1)); moveController.setSetpoint(Robot.getConst("Move Targ", 24)); - SmartDashboard.putData("Move PID", moveController); - moveController.enable(); // dt.enableVelocityPIDs(); } diff --git a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java b/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java index 9677eb0..183aca3 100644 --- a/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java +++ b/Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDTurn.java @@ -58,6 +58,7 @@ public PIDTurn(double targ, DrivetrainInterface dt, SmartDashboardInterface sd, turnController = new PIDController(sd.getConst("TurnkP", 1), sd.getConst("TurnkI", 0), sd.getConst("TurnkD", 0), kf, ahrs, this); // tim = new Timer(); + SmartDashboard.putData("Turn PID", turnController); } /** @@ -69,23 +70,21 @@ protected void initialize() { turnController.disable(); // dt.enableVelocityPIDs(); System.out.println("initialize2s"); - dt.resetAHRS(); + // dt.resetAHRS(); System.out.println("after reset"); System.out.println("after disabling"); // input is in degrees turnController.setInputRange(-180, 180); // output in "motor units" (arcade and tank only accept values [-1, 1] - turnController.setOutputRange(-1.0, 1.0); + turnController.setOutputRange(Robot.getConst("Output", 0.5) * -1, Robot.getConst("Output", 0.5)); turnController.setContinuous(true); turnController.setAbsoluteTolerance(Robot.getConst("TurnTolerance", 1)); - double newSetPoint = Robot.getConst("Turn Targ", 90); + double newSetPoint = Robot.getConst("Turn Targ", 90) + dt.getAHRSAngle(); while (Math.abs(newSetPoint) > 180) { newSetPoint = newSetPoint - Math.signum(newSetPoint) * 360; } turnController.setSetpoint(newSetPoint); - SmartDashboard.putData("Turn PID", turnController); - turnController.enable(); System.out.println("initialize finished"); // tim.start(); diff --git a/shuffleboard.json b/shuffleboard.json index 5d7bb03..978afee 100644 --- a/shuffleboard.json +++ b/shuffleboard.json @@ -1,5 +1,5 @@ { - "dividerPosition": 0.2218100890207715, + "dividerPosition": 0.45185185185185184, "tabPane": [ { "title": "PID Testing", @@ -41,9 +41,8 @@ "content": { "_type": "Graph", "_source0": "network_table:///SmartDashboard/Left Enc Rate", - "_title": "SmartDashboard/Left Enc Rate", - "Visible time": 30.0, - "SmartDashboard/Left Enc Rate visible": true + "_title": "/SmartDashboard/Left Enc Rate", + "Visible time": 30.0 } }, "5,2": { @@ -65,9 +64,8 @@ "content": { "_type": "Graph", "_source0": "network_table:///SmartDashboard/Right Enc Rate", - "_title": "SmartDashboard/Right Enc Rate", - "Visible time": 30.0, - "SmartDashboard/Right Enc Rate visible": true + "_title": "/SmartDashboard/Right Enc Rate", + "Visible time": 30.0 } }, "5,3": { @@ -242,17 +240,6 @@ "colorWhenTrue": "#7CFC00FF", "colorWhenFalse": "#8B0000FF" } - }, - "2,1": { - "size": [ - 2, - 1 - ], - "content": { - "_type": "Text View", - "_source0": "network_table:///SmartDashboard/Const/DPP", - "_title": "SmartDashboard/Const/DPP" - } } } } @@ -297,9 +284,8 @@ "content": { "_type": "Graph", "_source0": "network_table:///SmartDashboard/Right Enc Dist", - "_title": "SmartDashboard/Right Enc Dist", - "Visible time": 10.0, - "SmartDashboard/Right Enc Dist visible": true + "_title": "/SmartDashboard/Right Enc Dist", + "Visible time": 10.0 } }, "1,0": { @@ -310,14 +296,13 @@ "content": { "_type": "Graph", "_source0": "network_table:///SmartDashboard/Left Enc Dist", - "_title": "SmartDashboard/Left Enc Dist", - "Visible time": 10.0, - "SmartDashboard/Left Enc Dist visible": true + "_title": "/SmartDashboard/Left Enc Dist", + "Visible time": 10.0 } }, "5,0": { "size": [ - 2, + 1, 1 ], "content": { @@ -431,7 +416,7 @@ "hgap": 16.0, "vgap": 16.0, "tiles": { - "5,0": { + "1,0": { "size": [ 2, 1 @@ -475,7 +460,7 @@ "_title": "SmartDashboard/Turn PID Result" } }, - "5,1": { + "2,1": { "size": [ 1, 1 @@ -519,32 +504,6 @@ "_title": "SmartDashboard/Right VPID Error" } }, - "3,2": { - "size": [ - 2, - 2 - ], - "content": { - "_type": "Graph", - "_source0": "network_table:///SmartDashboard/Drivetrain/Left VPID Targ", - "_title": "SmartDashboard/Drivetrain/Left VPID Targ", - "Visible time": 30.0, - "SmartDashboard/Drivetrain/Left VPID Targ visible": true - } - }, - "5,2": { - "size": [ - 2, - 2 - ], - "content": { - "_type": "Graph", - "_source0": "network_table:///SmartDashboard/Drivetrain/Right VPID Targ", - "_title": "SmartDashboard/Drivetrain/Right VPID Targ", - "Visible time": 30.0, - "SmartDashboard/Drivetrain/Right VPID Targ visible": true - } - }, "0,2": { "size": [ 1, @@ -556,7 +515,7 @@ "_title": "SmartDashboard/Const/Turn Targ" } }, - "6,1": { + "1,1": { "size": [ 1, 1 @@ -566,32 +525,6 @@ "_source0": "network_table:///SmartDashboard/Const/TurnTolerance", "_title": "SmartDashboard/Const/TurnTolerance" } - }, - "3,0": { - "size": [ - 2, - 2 - ], - "content": { - "_type": "Graph", - "_source0": "network_table:///SmartDashboard/Drivetrain/Right Enc Dist", - "_title": "SmartDashboard/Drivetrain/Right Enc Dist", - "Visible time": 30.0, - "SmartDashboard/Drivetrain/Right Enc Dist visible": true - } - }, - "1,0": { - "size": [ - 2, - 2 - ], - "content": { - "_type": "Graph", - "_source0": "network_table:///SmartDashboard/Drivetrain/Left Enc Dist", - "_title": "SmartDashboard/Drivetrain/Left Enc Dist", - "Visible time": 30.0, - "SmartDashboard/Drivetrain/Left Enc Dist visible": true - } } } }