-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
686 additions
and
399 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
import frc.robot.Robot; | ||
|
||
public class ElevatorCP extends Command { | ||
double targetPosition = 0; | ||
double currentPosition; | ||
|
||
public ElevatorCP() { | ||
} | ||
|
||
@Override | ||
protected void initialize() { | ||
Robot.elevatorSubsytem.config(); | ||
} | ||
|
||
@Override | ||
protected void execute() { | ||
if (Robot.m_oi.getRightButton(5) && Robot.m_oi.elevatorPosition > 0) { | ||
Robot.m_oi.elevatorPosition--; | ||
} | ||
|
||
if (Robot.m_oi.getRightButton(6) && Robot.m_oi.elevatorPosition < 3) { | ||
Robot.m_oi.elevatorPosition++; | ||
} | ||
|
||
if (Robot.m_oi.elevatorPosition == 0){ | ||
targetPosition = -33073; | ||
} else if(Robot.m_oi.elevatorPosition == 1){ | ||
targetPosition = -40000; | ||
} else if (Robot.m_oi.elevatorPosition == 2){ | ||
targetPosition = -50000; | ||
} else if(Robot.m_oi.elevatorPosition == 3){ | ||
targetPosition = -60000; | ||
} else { | ||
targetPosition = 0; | ||
} | ||
|
||
currentPosition = Robot.elevatorSubsytem.getPosition(); | ||
if (currentPosition < targetPosition - 200) { | ||
Robot.elevatorSubsytem.setSpeed(-0.3); | ||
} else if (currentPosition > targetPosition + 200) { | ||
Robot.elevatorSubsytem.setSpeed(0.3); | ||
} else { | ||
Robot.elevatorSubsytem.setSpeed(0); | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean isFinished() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected void end() { | ||
Robot.elevatorSubsytem.setSpeed(0); | ||
} | ||
|
||
@Override | ||
protected void interrupted() { | ||
end(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*----------------------------------------------------------------------------*/ | ||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */ | ||
/* Open Source Software - may be modified and shared by FRC teams. The code */ | ||
/* must be accompanied by the FIRST BSD license file in the root directory of */ | ||
/* the project. */ | ||
/*----------------------------------------------------------------------------*/ | ||
|
||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
import frc.robot.Robot; | ||
|
||
public class HatchPanelCommand extends Command { | ||
public HatchPanelCommand() { | ||
} | ||
|
||
@Override | ||
protected void initialize() { | ||
} | ||
|
||
@Override | ||
protected void execute() { | ||
Robot.intakeSubsystem.setHatchSolenoid(true); | ||
} | ||
|
||
@Override | ||
protected boolean isFinished() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected void end() { | ||
Robot.intakeSubsystem.setHatchSolenoid(false); | ||
} | ||
|
||
@Override | ||
protected void interrupted() { | ||
end(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.