Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Robot2018/lib/User_Libraries.properties
Original file line number Diff line number Diff line change
@@ -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
36 changes: 17 additions & 19 deletions Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
2 changes: 1 addition & 1 deletion Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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();
Expand Down
93 changes: 13 additions & 80 deletions shuffleboard.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dividerPosition": 0.2218100890207715,
"dividerPosition": 0.45185185185185184,
"tabPane": [
{
"title": "PID Testing",
Expand Down Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down Expand Up @@ -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"
}
}
}
}
Expand Down Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down Expand Up @@ -431,7 +416,7 @@
"hgap": 16.0,
"vgap": 16.0,
"tiles": {
"5,0": {
"1,0": {
"size": [
2,
1
Expand Down Expand Up @@ -475,7 +460,7 @@
"_title": "SmartDashboard/Turn PID Result"
}
},
"5,1": {
"2,1": {
"size": [
1,
1
Expand Down Expand Up @@ -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,
Expand All @@ -556,7 +515,7 @@
"_title": "SmartDashboard/Const/Turn Targ"
}
},
"6,1": {
"1,1": {
"size": [
1,
1
Expand All @@ -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
}
}
}
}
Expand Down