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

Add clamp to move speed when during auto and intake is up #104

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8fad3f6
Merge branch 'master' of https://github.com/DriverStationComputer/Rob…
kevinzwang Mar 2, 2018
6d0f590
Merge branch 'master' of https://github.com/DeepBlueRobotics/RobotCod…
kevinzwang Mar 10, 2018
5d8f5d6
make lift wiggle room and number of stages preferences
Gabe-Mitnick Mar 11, 2018
1f762ad
Fixes to FindTurnTimeConstant and PIDTurn.
DriverStationComputer Mar 11, 2018
03f815a
Insignificant shuffleboard changes.
DriverStationComputer Mar 11, 2018
ebe418e
Merge branch 'lift-merging' of https://github.com/Gabe-Mitnick/RobotC…
lhmcgann Mar 13, 2018
93926ff
new lift setup
lhmcgann Mar 13, 2018
ae3344f
lots of Lift functionalities added
lhmcgann Mar 13, 2018
421d2d6
added lift button functionalities
lhmcgann Mar 13, 2018
cf2a53a
Merge branch 'lift' of https://github.com/lhmcgann/RobotCode2018 into…
kevinzwang Mar 14, 2018
2c19666
changed all PR comments
lhmcgann Mar 14, 2018
df46666
add eject commands
kevinzwang Mar 14, 2018
36c90ed
trello card checklist changes
lhmcgann Mar 14, 2018
0c1f8cc
lower to ground after scale eject
kevinzwang Mar 14, 2018
9dd6365
Merge pull request #1 from kevinzwang/lift-auto
lhmcgann Mar 14, 2018
833cdda
added stuff to testPeriodic in order to find lift's "holding" voltage
lhmcgann Mar 14, 2018
434360b
quick lift fixes
lhmcgann Mar 14, 2018
d83e7c7
PID by math setup
lhmcgann Mar 14, 2018
8c9d053
Merge branch 'master' of https://github.com/DeepBlueRobotics/RobotCod…
DriverStationComputer Mar 14, 2018
1320869
Merge branch 'lift' of https://github.com/lhmcgann/RobotCode2018.git …
DriverStationComputer Mar 14, 2018
cd525b2
Compute hopefully reasonable defaults for lift PID constants.
DriverStationComputer Mar 14, 2018
a9fdf4d
lift and intake work as expected :)
DriverStationComputer Mar 15, 2018
618015d
implemented HOLD_CUBE as first targ when told to go to the GROUND
lhmcgann Mar 16, 2018
bc420e3
other max spd option (commented out) in MoveLift
lhmcgann Mar 16, 2018
499526a
changed voltage offset default (Lift line 282) back to 0.25
lhmcgann Mar 16, 2018
82b7bdc
juft a shuffleboard layout saved
DriverStationComputer Mar 16, 2018
0777385
uncommented cams
DriverStationComputer Mar 16, 2018
e6c1538
stop intake button: manip btn 7
DriverStationComputer Mar 16, 2018
5af25ef
fixed kf in PIDMove
DriverStationComputer Mar 16, 2018
38deb6f
Merge branch 'master' of
DriverStationComputer Mar 16, 2018
eb6f6f3
changes to lift and intake
DriverStationComputer Mar 16, 2018
e7b22d9
deleted an empty line and fixed kf in PIDTurn
DriverStationComputer Mar 16, 2018
cf83e64
stopintake doesn't work
DriverStationComputer Mar 16, 2018
84b4434
fix StopIntake
DriverStationComputer Mar 17, 2018
0957fa6
set intake motor to be correct for intake/outtake commands
DriverStationComputer Mar 17, 2018
69e9b36
fixed UpdateLiftPosition so it goes to HOLD_CUBE before going to GROUND
DriverStationComputer Mar 17, 2018
8a1864d
deleted redundant line in PIDTurn
DriverStationComputer Mar 17, 2018
b2c7853
changed default max intake current for hasCube method to be much lower
DriverStationComputer Mar 17, 2018
0df70bc
a SD layout w/ cams
DriverStationComputer Mar 17, 2018
0a66931
just moving some commands/button around to try and make room on the
DriverStationComputer Mar 17, 2018
e1281cc
Merge branch 'master' of https://github.com/DriverStationComputer/Rob…
kevinzwang Mar 17, 2018
71efb41
raise lift earlier
kevinzwang Mar 17, 2018
5840827
Merge branch 'better-auto' of https://github.com/kevinzwang/RobotCode…
DriverStationComputer Mar 17, 2018
4da6cc7
Merge remote-tracking branch 'dsrepo/master'
dfang314 Mar 17, 2018
cb621a0
added quick clamp to movespeed when in auto and lift is up
dfang314 Mar 17, 2018
0904738
sfr working code (not breaking rn :))
DriverStationComputer Mar 17, 2018
dfa7f50
added file for motion profiling
dfang314 Mar 17, 2018
e6589cf
merge conflict in robot.java
dfang314 Mar 17, 2018
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
20 changes: 8 additions & 12 deletions AAAScripts/scripts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ moveto (0,120) #Drive past auto line
RRxx:
moveto (0,155)
turn -90
move 10
switch

RLxx:
move 56
turn -90
move 170
turn 90
move 35
move 25
switch


Expand All @@ -35,7 +34,6 @@ exchange
RRxE:
moveto (0,155)
turn -90
move 12
switch
turn -90
move 105
Expand All @@ -55,7 +53,7 @@ move 56
turn -90
move 170
turn 90
move 35
move 25
switch
move -40
turn 90
Expand All @@ -80,15 +78,14 @@ moveto (0, 120) #Drive past auto line
LLxx:
move 150
turn 90
move 12
switch

LRxx:
move 56
turn 90
move 170
turn -90
move 35
move 25
switch


Expand All @@ -106,7 +103,6 @@ exchange
LLxE:
move 150
turn 90
move 12
switch
turn 90
move 95
Expand All @@ -126,7 +122,7 @@ move 56
turn 90
move 170
turn -90
move 35
move 25
switch
move -40
turn -90
Expand All @@ -148,17 +144,17 @@ moveto (0,50) (48,50) (48,92) #cross baseline

# Switch
CRxx:
moveto (0,50) (48,50) (48,95)
moveto (0,50) (48,50) (48,85)
switch #deploy switch

CLxx:
moveto (0,50) (-56,50) (-56,95)
moveto (0,50) (-56,50) (-56,85)
switch #deploy switch


# Switch and Exchange
CRxE:
moveto (0,50) (48,50) (48,95)
moveto (0,50) (48,50) (48,85)
switch #deploy switch
move -48 # 3 feet back
turn -90
Expand All @@ -173,7 +169,7 @@ exchange


CLxE:
moveto (0,50) (-56,50) (-56,95)
moveto (0,50) (-56,50) (-56,85)
switch #deploy switch
move -48 # 3 feet back
turn 90
Expand Down
82 changes: 82 additions & 0 deletions CompSD.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<xml version="1.0">
<dashboard>
<widget field="Has Cube" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
<location x="0" y="132"/>
</widget>
<widget field="Intake Current Right" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
<location x="0" y="111"/>
</widget>
<widget field="Intake Current Left" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
<location x="0" y="90"/>
</widget>
<widget field="Left Current draw" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
<location x="482" y="581"/>
</widget>
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.RobotPreferences">
<location x="875" y="450"/>
</static-widget>
<widget field="Intake Open" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
<location x="487" y="556"/>
</widget>
<widget field="Right Solenoid Open" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
<location x="478" y="614"/>
</widget>
<widget field="Right Current draw" type="Number" class="edu.wpi.first.smartdashboard.gui.elements.TextBox">
<location x="493" y="601"/>
</widget>
<widget field="High Gear" type="Boolean" class="edu.wpi.first.smartdashboard.gui.elements.BooleanBox">
<location x="79" y="11"/>
<width>93</width>
<height>78</height>
</widget>
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
<location x="783" y="1"/>
<width>586</width>
<height>430</height>
<property name="Camera Choice" value="USB Camera 1"/>
</static-widget>
<static-widget class="edu.wpi.first.smartdashboard.gui.elements.CameraServerViewer">
<location x="148" y="2"/>
<width>630</width>
<height>459</height>
<property name="Camera Choice" value=""/>
</static-widget>
<widget field="LR" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
<location x="31" y="2"/>
</widget>
<widget field="LL" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
<location x="16" y="12"/>
</widget>
<widget field="RR" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
<location x="4" y="11"/>
</widget>
<widget field="Starting Position" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
<location x="11" y="16"/>
</widget>
<widget field="RL" type="String Chooser" class="edu.wpi.first.smartdashboard.gui.elements.Chooser">
<location x="13" y="30"/>
</widget>
</dashboard>
<live-window>
</live-window>
<hidden field="Right PID Controller"/>
<hidden field="VPID Right kI"/>
<hidden field="VPID Left kI"/>
<hidden field="Turn PID Error"/>
<hidden field="Auto Delay"/>
<hidden field="PIDController[2]"/>
<hidden field="Move PID Error"/>
<hidden field="Turn PID"/>
<hidden field="Left PID Controller"/>
<hidden field="Left Solenoid Open"/>
<hidden field="Angle"/>
<hidden field="Turn PID Result"/>
<hidden field="Move PID"/>
<hidden field="VPID kF"/>
<hidden field="Move PID Output"/>
<hidden field="PIDController[1]"/>
<hidden field="VPID Right kP"/>
<hidden field="VPID Left kP"/>
<hidden field="Turn PID Output"/>
<hidden field="Move PID Result"/>
</xml>
82 changes: 52 additions & 30 deletions Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@

package org.usfirst.frc.team199.Robot2018;

import org.usfirst.frc.team199.Robot2018.commands.CloseIntake;
import org.usfirst.frc.team199.Robot2018.commands.AutoLift;
import org.usfirst.frc.team199.Robot2018.commands.FindTurnTimeConstant;
import org.usfirst.frc.team199.Robot2018.commands.IntakeCube;
import org.usfirst.frc.team199.Robot2018.commands.OpenIntake;
import org.usfirst.frc.team199.Robot2018.commands.MoveLift;
import org.usfirst.frc.team199.Robot2018.commands.MoveLiftWithPID;
import org.usfirst.frc.team199.Robot2018.commands.OuttakeCube;
import org.usfirst.frc.team199.Robot2018.commands.PIDMove;
import org.usfirst.frc.team199.Robot2018.commands.PIDTurn;
import org.usfirst.frc.team199.Robot2018.commands.ResetEncoders;
import org.usfirst.frc.team199.Robot2018.commands.RunLift;
import org.usfirst.frc.team199.Robot2018.commands.SetDistancePerPulse;
import org.usfirst.frc.team199.Robot2018.commands.ShiftDriveType;
import org.usfirst.frc.team199.Robot2018.commands.ShiftHighGear;
import org.usfirst.frc.team199.Robot2018.commands.ShiftLowGear;
import org.usfirst.frc.team199.Robot2018.commands.ToggleLeftIntake;
import org.usfirst.frc.team199.Robot2018.commands.ToggleRightIntake;
import org.usfirst.frc.team199.Robot2018.commands.StopIntake;
import org.usfirst.frc.team199.Robot2018.commands.ToggleIntake;
import org.usfirst.frc.team199.Robot2018.commands.UpdatePIDConstants;
import org.usfirst.frc.team199.Robot2018.subsystems.LiftInterface.LiftHeight;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
Expand All @@ -48,6 +49,9 @@ public class OI {
private JoystickButton resetEncButton;
private JoystickButton moveLiftUpButton;
private JoystickButton moveLiftDownButton;
private JoystickButton moveLiftPIDUpButton;
private JoystickButton moveLiftPIDDownButton;
private JoystickButton testLiftPID;
private JoystickButton findTurnTimeConstantButton;
private JoystickButton updatePIDConstantsButton;
private JoystickButton updateEncoderDPPButton;
Expand All @@ -61,6 +65,8 @@ public class OI {
private JoystickButton outakeCubeButton;
private JoystickButton toggleLeftIntakeButton;
private JoystickButton toggleRightIntakeButton;
private JoystickButton toggleIntakeButton;
private JoystickButton stopIntakeButton;

public int getButton(String key, int def) {
if (!SmartDashboard.containsKey("Button/" + key)) {
Expand Down Expand Up @@ -92,6 +98,10 @@ public OI(Robot robot) {
findTurnTimeConstantButton
.whenPressed(new FindTurnTimeConstant(robot, Robot.dt, Robot.rmap.fancyGyro, Robot.sd));

testLiftPID = new JoystickButton(leftJoy, getButton("Test Lift PID", 5));
testLiftPID.whenPressed(
new AutoLift(Robot.lift, SmartDashboard.getString("Lift Targ Height", LiftHeight.SWITCH.toString())));

rightJoy = new Joystick(1);
shiftHighGearButton = new JoystickButton(rightJoy, getButton("Shift High Gear", 4));
shiftHighGearButton.whenPressed(new ShiftHighGear());
Expand All @@ -104,34 +114,46 @@ public OI(Robot robot) {
updateEncoderDPPButton.whenPressed(new SetDistancePerPulse());

moveLiftUpButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Up", 10));
moveLiftUpButton.whileHeld(new RunLift(Robot.lift, true));
moveLiftUpButton.whileHeld(new MoveLift(Robot.lift, true));
moveLiftDownButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Down", 11));
moveLiftDownButton.whileHeld(new RunLift(Robot.lift, false));
moveLiftDownButton.whileHeld(new MoveLift(Robot.lift, false));

manipulator = new Joystick(2);
if (manipulator.getButtonCount() == 0) {
System.err.println(
"ERROR: manipulator does not appear to be plugged in. Disabling intake code. Restart code with manipulator plugged in to enable intake code");
} else {
closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
closeIntakeButton.whenPressed(new CloseIntake());
openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
openIntakeButton.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());
intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5));
intakeCubeButton.whenPressed(new IntakeCube());
outakeCubeButton = new JoystickButton(manipulator, getButton("Outake Button", 6));
outakeCubeButton.whenPressed(new OuttakeCube());
toggleLeftIntakeButton = new JoystickButton(manipulator, getButton("Toggle Left Intake Button", 3));
toggleLeftIntakeButton.whenPressed(new ToggleLeftIntake());
toggleRightIntakeButton = new JoystickButton(manipulator, getButton("Toggle Right Intake Button", 4));
toggleRightIntakeButton.whenPressed(new ToggleRightIntake());
}
// if (manipulator.getButtonCount() == 0) {
// System.err.println(
// "ERROR: manipulator does not appear to be plugged in. Disabling intake code.
// Restart code with manipulator plugged in to enable intake code");
// } else {

// closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake
// Button", 1));
// closeIntakeButton.whenPressed(new CloseIntake());
// openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake
// Button", 2));
// openIntakeButton.whenPressed(new OpenIntake());

moveLiftPIDUpButton = new JoystickButton(manipulator, getButton("Run Lift PID Up", 4));
moveLiftPIDUpButton.whileHeld(new MoveLiftWithPID(Robot.lift, true));
moveLiftPIDDownButton = new JoystickButton(manipulator, getButton("Run Lift PID Down", 1));
moveLiftPIDDownButton.whileHeld(new MoveLiftWithPID(Robot.lift, false));

toggleIntakeButton = new JoystickButton(manipulator, getButton("Toggle Intake Button", 2));
toggleIntakeButton.whenPressed(new ToggleIntake());

stopIntakeButton = new JoystickButton(manipulator, getButton("Stop Intake Button", 3));
stopIntakeButton.whenPressed(new StopIntake());

intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5));
intakeCubeButton.whenPressed(new IntakeCube());
outakeCubeButton = new JoystickButton(manipulator, getButton("Outake Button", 6));
outakeCubeButton.whenPressed(new OuttakeCube());
// toggleLeftIntakeButton = new JoystickButton(manipulator, getButton("Toggle
// Left Intake Button", 3));
// toggleLeftIntakeButton.whenPressed(new ToggleLeftIntake());
// toggleRightIntakeButton = new JoystickButton(manipulator, getButton("Toggle
// Right Intake Button", 4));
// toggleRightIntakeButton.whenPressed(new ToggleRightIntake());
// }

}

Expand Down
Loading