Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Robot2019/src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void robotPeriodic() {

@Override
public void disabledInit() {
cargo.stopIntake();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected boolean isFinished() {

@Override
protected void end() {
cargo.stopIntake();
cargo.keepIntake();
}

@Override
Expand Down
18 changes: 15 additions & 3 deletions Robot2019/src/main/java/frc/robot/subsystems/Cargo.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public class Cargo extends Subsystem {
// Put methods for controlling this subsystem
// here. Call these from Commands.

private final double intakeCurrentThreshold = 8.0; // Amps
private final double rollerIntakeSpeed = 4.0 / 12;
private final double rollerStallSpeed = 3.0 / 12;
private final double rollerEjectSpeed = 12.0 / 12;

private VictorSP roller;
private PowerDistributionPanel pdp;
private int rollerPort; // The port for the VictorSP on the PDP, not the RoboRIO.
Expand All @@ -29,16 +34,23 @@ public void stopIntake() {
roller.stopMotor();
}

/**
* keeps the cargo in the mechanism by running the rollers at a slower speed
*/
public void keepIntake() {
roller.set(rollerStallSpeed);
}

public void runIntake() {
roller.set(-1);
roller.set(rollerIntakeSpeed);
}

public void runEject() {
roller.set(1);
roller.set(-1 * rollerEjectSpeed);
}

public boolean hasCargo() {
return pdp.getCurrent(rollerPort) > 15;
return pdp.getCurrent(roller.getChannel()) > intakeCurrentThreshold;
}

@Override
Expand Down