Skip to content
This repository has been archived by the owner on Apr 27, 2018. It is now read-only.

Commit

Permalink
changes made at competition on Sunday
Browse files Browse the repository at this point in the history
  • Loading branch information
ac8774 committed Mar 13, 2017
1 parent c5266dd commit 0af3c95
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 39 deletions.
Binary file modified bin/org/usfirst/frc/team5338/robot/OI.class
Binary file not shown.
Binary file modified bin/org/usfirst/frc/team5338/robot/commands/Autonomous.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/org/usfirst/frc/team5338/robot/commands/Turn.class
Binary file not shown.
Binary file modified bin/org/usfirst/frc/team5338/robot/subsystems/DriveTrain.class
Binary file not shown.
Binary file modified build/org/usfirst/frc/team5338/robot/OI.class
Binary file not shown.
Binary file modified build/org/usfirst/frc/team5338/robot/commands/Autonomous.class
Binary file not shown.
Binary file not shown.
Binary file modified build/org/usfirst/frc/team5338/robot/commands/Turn.class
Binary file not shown.
Binary file modified build/org/usfirst/frc/team5338/robot/subsystems/DriveTrain.class
Binary file not shown.
Binary file modified dist/FRCUserProgram.jar
Binary file not shown.
27 changes: 13 additions & 14 deletions src/org/usfirst/frc/team5338/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum DriveState
public OI()
{
ballState = BallState.OFF;
driveState = DriveState.FORWARD;
driveState = DriveState.REVERSE;
}
public Joystick getJoystick(int n)
{
Expand All @@ -42,39 +42,38 @@ public boolean get(Button button)
switch(button)
{
case OFF:
return joyR.getRawButton(3);
return joyR.getRawButton(5);
case LOWER_INTAKE:
return joyR.getRawButton(6);
case UPPER_INTAKE:
return joyR.getRawButton(4);
case UPPER_INTAKE:
return joyR.getRawButton(6);
case OUTTAKE:
return joyR.getRawButton(5);
return joyR.getRawButton(3);
case SLOW:
return joyL.getRawButton(1);
case STRAIGHT:
return joyR.getRawButton(1);
case STRAIGHT:
return joyL.getRawButton(1);
case REVERSE:
return joyL.getRawButton(2);
case FORWARD:
return joyR.getRawButton(2);
case GEAR:
return joyL.getRawButton(3);
return joyL.getRawButton(5);
case WINCH:
return joyL.getRawButton(4);

return joyL.getRawButton(6);
default:
return false;
}
}
private double joystickDeadZone(double value)
{
if (value > 0.08 || value < -0.08)
if (value > 0.04 || value < -0.04)
{
return (value - 0.08)/0.92;
return (value - 0.04)/0.96;
}
else if (value < -0.08)
else if (value < -0.04)
{
return (value + 0.08)/0.92;
return (value + 0.04)/0.96;
}
return 0.0;
}
Expand Down
47 changes: 29 additions & 18 deletions src/org/usfirst/frc/team5338/robot/commands/Autonomous.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,45 @@ public class Autonomous extends CommandGroup
{
public Autonomous()
{
switch("CENTER")
switch("CENTERGEAR-RIGHT")
{
case "CENTER":
addSequential(new Move(4));
case "CENTERGEAR-LEFT":
addSequential(new MoveSlowly(4));
addSequential(new DepositGear());
// addSequential(new Turn(90));
// addSequential(new Move(1));
// addSequential(new Turn(-90));
// addSequential(new Move(4));
addSequential(new Turn(-90));
addSequential(new MoveFast(1));
addSequential(new Turn(100));
addSequential(new MoveFast(3));
break;
case "LEFT":
addSequential(new Move(6));
case "CENTERGEAR-RIGHT":
addSequential(new MoveSlowly(4));
addSequential(new DepositGear());
addSequential(new MoveSlowly(-1));
addSequential(new Turn(100));
addSequential(new MoveFast(1));
addSequential(new Turn(-100));
addSequential(new MoveFast(3));
break;
case "LEFTGEAR":
addSequential(new MoveSlowly(3));
addSequential(new Turn(60));
addSequential(new MoveSlowly(4));
addSequential(new DepositGear());
addSequential(new MoveSlowly(-1));
addSequential(new Turn(-60));
addSequential(new Move(3));
addSequential(new MoveFast(3));
break;
case "RIGHT":
addSequential(new Move(6));
case "RIGHTGEAR":
addSequential(new MoveSlowly(3));
addSequential(new Turn(-60));
addSequential(new MoveSlowly(4));
addSequential(new DepositGear());
addSequential(new MoveSlowly(-1));
addSequential(new Turn(60));
addSequential(new Move(3));
break;
case "TEST":
addSequential(new Turn(360));
addSequential(new Turn(-360));
addSequential(new MoveFast(3));
break;
case "BASELINE":
addSequential(new Move(6));
addSequential(new MoveFast(4));
break;
default:
break;
Expand Down
5 changes: 3 additions & 2 deletions src/org/usfirst/frc/team5338/robot/commands/DepositGear.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public DepositGear()
{
requires(Robot.drivetrain);
requires(Robot.gearhandler);
setTimeout(4);
setTimeout(2);
}
protected void execute()
{
Robot.gearhandler.setGears(DoubleSolenoid.Value.kReverse);
if(timeSinceInitialized() >= 2.0)
if(timeSinceInitialized() >= 0.75)
Robot.drivetrain.drive(0.25, 0.25);
}
protected boolean isFinished()
Expand All @@ -26,5 +26,6 @@ protected boolean isFinished()
protected void end()
{
Robot.drivetrain.drive(0.0, 0.0);
Robot.gearhandler.setGears(DoubleSolenoid.Value.kForward);
}
}
35 changes: 35 additions & 0 deletions src/org/usfirst/frc/team5338/robot/commands/MoveFast.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.usfirst.frc.team5338.robot.commands;

import org.usfirst.frc.team5338.robot.Robot;

import edu.wpi.first.wpilibj.command.Command;

public class MoveFast extends Command
{
int seconds;
public MoveFast(int input)
{
seconds = input;
requires(Robot.drivetrain);
setTimeout(Math.abs(seconds));
}
protected void execute()
{
if(seconds > 0)
{
Robot.drivetrain.drive(-0.75, -0.75);
}
else
{
Robot.drivetrain.drive(0.75, 0.75);
}
}
protected boolean isFinished()
{
return isTimedOut();
}
protected void end()
{
Robot.drivetrain.drive(0.0, 0.0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import edu.wpi.first.wpilibj.command.Command;

public class Move extends Command
public class MoveSlowly extends Command
{
int seconds;
public Move(int input)
public MoveSlowly(int input)
{
seconds = input;
requires(Robot.drivetrain);
Expand Down
2 changes: 1 addition & 1 deletion src/org/usfirst/frc/team5338/robot/commands/Turn.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Turn extends Command
int degrees;
public Turn(int angle)
{
degrees = angle;
degrees = angle*12/13;
requires(Robot.drivetrain);
setTimeout((int)(Math.ceil(Math.abs(degrees / 72.5))));
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/usfirst/frc/team5338/robot/subsystems/DriveTrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ else if(oi.get(OI.Button.FORWARD))
case REVERSE:
if(oi.get(OI.Button.STRAIGHT))
{
DRIVE.tankDrive(oi.getRight(), oi.getRight(), false);
DRIVE.tankDrive(oi.getLeft(), oi.getLeft(), false);
}
else
{
Expand All @@ -64,7 +64,7 @@ else if(oi.get(OI.Button.FORWARD))
case FORWARD:
if(oi.get(OI.Button.STRAIGHT))
{
DRIVE.tankDrive(-oi.getRight(), -oi.getRight(), false);
DRIVE.tankDrive(-oi.getLeft(), -oi.getLeft(), false);
}
else
{
Expand Down

0 comments on commit 0af3c95

Please sign in to comment.