Skip to content

Commit

Permalink
Merge pull request #5 from team1635/TestingRC
Browse files Browse the repository at this point in the history
Latest Fallback Code
  • Loading branch information
Acelogic authored Mar 31, 2017
2 parents 1b8ec96 + 1e0f4cc commit aef8366
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 307 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public AutonomousVisionLeft() {
addSequential(new TurnToSetPointLi(RobotMap.autoLeftTurnRight, true));
addSequential(new DriveWithVision());
// next method takes double executionTime, double speed
addSequential(new TimeoutDriveWithCorrectionSlow(
RobotMap.autoVisionStraightTime
, RobotMap.autoVisionStraightSpeed));
addSequential(
new TimeoutDriveWithCorrectionSlow(RobotMap.autoVisionStraightTime, RobotMap.autoVisionStraightSpeed));
addSequential(new WiggleForward());
}
}
16 changes: 6 additions & 10 deletions src/org/usfirst/frc/team1635/robot/OI.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.usfirst.frc.team1635.robot;

import org.usfirst.frc.team1635.robot.commands.GusGearIntake;
import org.usfirst.frc.team1635.robot.commands.BottomOutElevator;

import org.usfirst.frc.team1635.robot.commands.ShootBalls;
import org.usfirst.frc.team1635.robot.commands.WiggleForward;
//Local Package Imports
import org.usfirst.frc.team1635.util.XboxControllerButton;
Expand Down Expand Up @@ -51,8 +50,8 @@ public class OI {
DPadButton dPadLeft = new DPadButton(gameController, DPadButton.Direction.Left);
DPadButton dPadRight = new DPadButton(gameController, DPadButton.Direction.Right);

// -----------------------------------------------------------------------------------
// For DualControllers
// -----------------------------------------------------------------------------------
// For DualControllers
public boolean globalA;
public boolean globalB;
public boolean globalX;
Expand Down Expand Up @@ -86,18 +85,15 @@ public void masterToSecondary(XboxController master, XboxController secondary) {
this.globalStartButton = master.getStartButton() || secondary.getStartButton();
}

// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------

public OI() {
aButton.whenPressed(new WiggleForward());
aButton2.whenPressed(new WiggleForward());
// Don't use B - we switch camera with it.

dPadUp.whenPressed(new ShootBalls());
dPadUp2.whenPressed(new ShootBalls());

dPadDown.whenPressed(new GusGearIntake());
dPadDown2.whenPressed(new GusGearIntake());
dPadDown.whenPressed(new BottomOutElevator());
dPadDown2.whenPressed(new BottomOutElevator());
// dPadLeft.whenPressed(new PopGearWithFlapsDown());
}

Expand Down
2 changes: 2 additions & 0 deletions src/org/usfirst/frc/team1635/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ public void disabledInit() {
*/
public void teleopPeriodic() {
Scheduler.getInstance().run();
Robot.oi.masterToSecondary(Robot.oi.StartController(), Robot.oi.StartController2());
if (Robot.oi.globalB) {
Timer.delay(0.2);
forwardCameraOn = !(forwardCameraOn);
}

SmartDashboard.putBoolean("forwardCameraOn", forwardCameraOn);
// if (Robot.oi.gameController.getXButton()) {
// Timer.delay(0.2);
Expand Down
4 changes: 2 additions & 2 deletions src/org/usfirst/frc/team1635/robot/RobotMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class RobotMap {
// ------------------------------------------------------------
// CAN IDs/Ports
public static int elevatorMotorCANPort = 3;
public static int elevatorRollerMotorCANPort = 2;
public static int elevatorRollerMotorCANPort;
// Drive
public static int frontLeftMotorCANPort = 4;
public static int frontLeftMotorCANPort = 2; // 4 Died Replacing with 2
public static int frontRightMotorCANPort = 6;
public static int backLeftMotorCANPort = 1;
public static int backRightMotorCANPort = 5;
Expand Down
46 changes: 46 additions & 0 deletions src/org/usfirst/frc/team1635/robot/commands/BottomOutElevator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.usfirst.frc.team1635.robot.commands;

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

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

/**
*
*/
public class BottomOutElevator extends Command {
boolean isBottomedOut;

public BottomOutElevator() {
requires(Robot.elevatorSystem);
}

// Called just before this Command runs the first time
protected void initialize() {

}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
isBottomedOut = Robot.elevatorSystem.IsElevatorBottomedOut();
Robot.elevatorSystem.setElevatorSpeed(-0.5);

}

// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return isBottomedOut;
}

// Called once after isFinished returns true
protected void end() {
Robot.elevatorSystem.stopElevator();

}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}
58 changes: 0 additions & 58 deletions src/org/usfirst/frc/team1635/robot/commands/ControlDrive.java

This file was deleted.

56 changes: 0 additions & 56 deletions src/org/usfirst/frc/team1635/robot/commands/GusGearIntake.java

This file was deleted.

76 changes: 0 additions & 76 deletions src/org/usfirst/frc/team1635/robot/commands/ShootBalls.java

This file was deleted.

57 changes: 57 additions & 0 deletions src/org/usfirst/frc/team1635/robot/control/ControlDrive.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.usfirst.frc.team1635.robot.control;

//Local Package Imports
import org.usfirst.frc.team1635.robot.Robot;
//------------------------------------------------------------
// WPILIB Imports
import edu.wpi.first.wpilibj.command.Command;
//------------------------------------------------------------

//.---. ,--. .-----. .------.
///_ | / .' / -. \| ___|
//| |. / -. '-' _' || '--.
//| || .-. ' |_ < `---. '.
//| |' \ | |.-. | |.- | |
//| |\ `' / \ `-' /| `-' /
//`---' `----' `----'' `----''

/**
*
* @author Bogdan Bradu & Miguel Cruz ( @Acelogic_)
*
*/
public class ControlDrive extends Command {

public ControlDrive() {
// Use requires() here to declare subsystem dependencies
requires(Robot.chassisSystem);

}

// Called just before this Command runs the first time
protected void initialize() {
}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.oi.masterToSecondary(Robot.oi.StartController(), Robot.oi.StartController2());
Robot.chassisSystem.drive();
Robot.chassisSystem.log();

}

// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
protected void end() {
Robot.chassisSystem.stop();
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.usfirst.frc.team1635.robot.commands;
package org.usfirst.frc.team1635.robot.control;

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

Expand All @@ -22,7 +22,6 @@ protected void initialize() {
// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.elevatorSystem.controlElevator();
Robot.elevatorSystem.elevatorRollerControl();
Robot.elevatorSystem.log();
}

Expand Down
Loading

0 comments on commit aef8366

Please sign in to comment.