Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 38deb6f

Browse files
Merge branch 'master' of
https://github.com/DriverStationComputer/RobotCode2018.git into lift Conflicts: Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java
2 parents 82b7bdc + 5af25ef commit 38deb6f

5 files changed

Lines changed: 104 additions & 4 deletions

File tree

CompSD.xml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<xml version="1.0">
2+
<dashboard>
3+
<widget field="High Gear" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.BooleanBox">
4+
<location x="14" y="4"/>
5+
<width>93</width>
6+
<height>78</height>
7+
</widget>
8+
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
9+
<location x="830" y="4"/>
10+
<width>529</width>
11+
<height>399</height>
12+
<property name="Camera Choice" value="USB Camera 1"/>
13+
</static-widget>
14+
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
15+
<location x="324" y="17"/>
16+
<width>502</width>
17+
<height>383</height>
18+
<property name="Camera Choice" value=""/>
19+
</static-widget>
20+
<widget field="Turn PID" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
21+
<location x="182" y="426"/>
22+
</widget>
23+
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.RobotPreferences">
24+
<location x="6" y="87"/>
25+
<width>284</width>
26+
<height>205</height>
27+
</static-widget>
28+
<widget field="LR" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
29+
<location x="31" y="2"/>
30+
</widget>
31+
<widget field="LL" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
32+
<location x="16" y="12"/>
33+
</widget>
34+
<widget field="Left PID Controller" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
35+
<location x="51" y="417"/>
36+
</widget>
37+
<widget field="PIDController[1]" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
38+
<location x="134" y="229"/>
39+
</widget>
40+
<widget field="RR" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
41+
<location x="4" y="11"/>
42+
</widget>
43+
<widget field="Starting Position" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
44+
<location x="11" y="16"/>
45+
</widget>
46+
<widget field="Move PID" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
47+
<location x="32" y="467"/>
48+
</widget>
49+
<widget field="Right PID Controller" type="PIDController" class="edu.wpi.first.smartdashboard.gui.elements.PIDEditor">
50+
<location x="-26" y="264"/>
51+
<width>159</width>
52+
</widget>
53+
<widget field="RL" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
54+
<location x="13" y="30"/>
55+
</widget>
56+
</dashboard>
57+
<live-window>
58+
</live-window>
59+
<hidden field="VPID Right kI"/>
60+
<hidden field="VPID Left kI"/>
61+
<hidden field="Turn PID Error"/>
62+
<hidden field="Auto Delay"/>
63+
<hidden field="Move PID Error"/>
64+
<hidden field="Angle"/>
65+
<hidden field="Turn PID Result"/>
66+
<hidden field="VPID kF"/>
67+
<hidden field="Move PID Output"/>
68+
<hidden field="VPID Right kP"/>
69+
<hidden field="VPID Left kP"/>
70+
<hidden field="Turn PID Output"/>
71+
<hidden field="Move PID Result"/>
72+
</xml>

Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.usfirst.frc.team199.Robot2018.commands.ShiftDriveType;
2323
import org.usfirst.frc.team199.Robot2018.commands.ShiftHighGear;
2424
import org.usfirst.frc.team199.Robot2018.commands.ShiftLowGear;
25+
import org.usfirst.frc.team199.Robot2018.commands.StopIntake;
2526
import org.usfirst.frc.team199.Robot2018.commands.ToggleLeftIntake;
2627
import org.usfirst.frc.team199.Robot2018.commands.ToggleRightIntake;
2728
import org.usfirst.frc.team199.Robot2018.commands.UpdatePIDConstants;
@@ -67,6 +68,7 @@ public class OI {
6768
private JoystickButton outakeCubeButton;
6869
private JoystickButton toggleLeftIntakeButton;
6970
private JoystickButton toggleRightIntakeButton;
71+
private JoystickButton stopIntakeButton;
7072

7173
public int getButton(String key, int def) {
7274
if (!SmartDashboard.containsKey("Button/" + key)) {
@@ -146,6 +148,9 @@ public OI(Robot robot) {
146148
toggleLeftIntakeButton.whenPressed(new ToggleLeftIntake());
147149
toggleRightIntakeButton = new JoystickButton(manipulator, getButton("Toggle Right Intake Button", 4));
148150
toggleRightIntakeButton.whenPressed(new ToggleRightIntake());
151+
152+
stopIntakeButton = new JoystickButton(manipulator, getButton("Stop Intake Button", 7));
153+
stopIntakeButton.whenPressed(new StopIntake());
149154
}
150155

151156
}

Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.usfirst.frc.team199.Robot2018.subsystems.IntakeEject;
2424
import org.usfirst.frc.team199.Robot2018.subsystems.Lift;
2525

26+
import edu.wpi.first.wpilibj.CameraServer;
2627
import edu.wpi.first.wpilibj.DriverStation;
2728
import edu.wpi.first.wpilibj.IterativeRobot;
2829
import edu.wpi.first.wpilibj.PIDController;
@@ -179,10 +180,9 @@ public void robotInit() {
179180
autoScripts = AutoUtils.parseScriptFile(Preferences.getInstance().getString("autoscripts", ""));
180181

181182
listen = new Listener();
182-
// CameraServer.getInstance().startAutomaticCapture(0);
183-
// CameraServer.getInstance().startAutomaticCapture(1);
184-
185183
lift.resetEnc();
184+
CameraServer.getInstance().startAutomaticCapture(0);
185+
CameraServer.getInstance().startAutomaticCapture(1);
186186
}
187187

188188
/**

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/PIDMove.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public PIDMove(double target, double[] point, DrivetrainInterface dt, SmartDashb
6767
double kP = r / Robot.rmap.getDrivetrainTimeConstant() / maxSpeed;
6868
double kI = 0;
6969
double kD = r / maxSpeed;
70-
double kF = 1 / (maxSpeed * sd.getConst("Default PID Update Time", 0.05)) / maxSpeed;
70+
double kF = 1 / maxSpeed * sd.getConst("Default PID Update Time", 0.05);
7171

7272
moveController = new PIDController(kP, kI, kD, kF, avg, this);
7373
sd.putData("Move PID", moveController);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.usfirst.frc.team199.Robot2018.commands;
2+
3+
import org.usfirst.frc.team199.Robot2018.Robot;
4+
5+
import edu.wpi.first.wpilibj.command.InstantCommand;
6+
7+
/**
8+
*
9+
*/
10+
public class StopIntake extends InstantCommand {
11+
12+
public StopIntake() {
13+
// Use requires() here to declare subsystem dependencies
14+
// eg. requires(chassis);
15+
super();
16+
}
17+
18+
// Called just before this Command runs the first time
19+
@Override
20+
protected void initialize() {
21+
Robot.intakeEject.stopIntake();
22+
}
23+
}

0 commit comments

Comments
 (0)