Skip to content

Commit

Permalink
Added StopElevator command
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonisrailov committed Feb 10, 2018
1 parent 918c523 commit e9006e1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/org/usfirst/frc/team4737/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the TimedRobot
Expand Down
38 changes: 38 additions & 0 deletions src/org/usfirst/frc/team4737/robot/commands/StopElevator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.usfirst.frc.team4737.robot.commands;

import org.usfirst.frc.team4737.robot.subsystems.Elevator;

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

/**
*
*/
public class StopElevator extends Command {

public StopElevator() {
requires(Elevator.getInstance());
}

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

// Called repeatedly when this Command is scheduled to run
protected void execute() {
Elevator.getInstance().setSpeed(0);
}

// 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() {
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}
4 changes: 2 additions & 2 deletions src/org/usfirst/frc/team4737/robot/subsystems/Climber.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
public class Climber extends Subsystem {

private static Climber instance = new Climber ();
private static Climber instance = new Climber();

public static Climber getInstance() {
return instance;
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*
*/
public class Drivetrain extends Subsystem {

private static Drivetrain instance = new Drivetrain();

public static Drivetrain getInstance() {
return instance;
}
Expand Down
16 changes: 13 additions & 3 deletions src/org/usfirst/frc/team4737/robot/subsystems/Elevator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.usfirst.frc.team4737.robot.subsystems;

import org.usfirst.frc.team4737.robot.RobotMap;
import org.usfirst.frc.team4737.robot.commands.StopElevator;

import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;

Expand All @@ -10,9 +11,9 @@
*
*/
public class Elevator extends Subsystem {

private static Elevator instance = new Elevator();

public static Elevator getInstance() {
return instance;
}
Expand All @@ -30,6 +31,15 @@ public Elevator() {

public void initDefaultCommand() {
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
setDefaultCommand(new StopElevator());
}

/**
*
* @param speed
* ranges from -1 to 1
*/
public void setSpeed(double speed) {
// TODO
}
}
2 changes: 1 addition & 1 deletion src/org/usfirst/frc/team4737/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class Intake extends Subsystem {

private static Intake instance = new Intake();

public static Intake getInstance() {
return instance;
}
Expand Down

0 comments on commit e9006e1

Please sign in to comment.