Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added bump commands #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions rio/src/main/java/org/teamtators/levitator/commands/BumpLift.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.teamtators.levitator.commands;

import org.teamtators.common.scheduler.Command;
import org.teamtators.levitator.TatorRobot;
import org.teamtators.levitator.subsystems.Lift;

public class BumpLift extends Command{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be "LiftBump"?


private Lift lift;
private double bumpheight;

public BumpLift(TatorRobot robot, boolean goUp, double bumpHeight) {
super("bumpLift");
lift = robot.getSubsystems().getLift();
requires(lift);
}

@Override
protected boolean step() {
lift.setDesiredHeight(lift.getCurrentHeight() + bumpheight);
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you override the initialize and finish methods, and replace the logging that is in Command with something more specific to this command. (eg. "Bumping lift [number] inches")

}
24 changes: 24 additions & 0 deletions rio/src/main/java/org/teamtators/levitator/commands/BumpPivot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.teamtators.levitator.commands;

import org.teamtators.common.scheduler.Command;
import org.teamtators.levitator.TatorRobot;
import org.teamtators.levitator.subsystems.Lift;

public class BumpPivot extends Command {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for this one


private Lift lift;
private double bumpAngle;

public BumpPivot(TatorRobot robot, boolean pivotRight, double bumpAngle) {
super("bumpPivot");
lift = robot.getSubsystems().getLift();
requires(lift);
}

@Override
protected boolean step() {
lift.setDesiredPivotAngle(lift.getCurrentPivotAngle() + bumpAngle);
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public void register(ConfigCommandStore commandStore) {
commandStore.putCommand("PickerExtend", Commands.instant(picker::extend, picker));
commandStore.putCommand("PickerRetract", Commands.instant(picker::retract, picker));

commandStore.putCommand("BumpLiftUp", Commands.instant(lift::bumpLiftUp));
commandStore.putCommand("BumpLiftDown", Commands.instant(lift::bumpLiftDown));
commandStore.putCommand("BumpPivotRight", Commands.instant(lift::bumpPivotRight));
commandStore.putCommand("BumpPivotLeft", Commands.instant(lift::bumpPivotRight));
commandStore.registerCommand("BumpLift", () -> new BumpLift(robot, true, 8));
commandStore.registerCommand("BumpPivot", () -> new BumpPivot(robot, false, 56));
}
}
16 changes: 0 additions & 16 deletions rio/src/main/java/org/teamtators/levitator/subsystems/Lift.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,6 @@ public void setLiftPower(double liftPower) {
liftMotor.set(liftPower);
}

public void bumpLiftUp() {
setDesiredHeight(getCurrentHeight() + config.bumpHeightValue);
}

public void bumpLiftDown() {
setDesiredHeight(getCurrentHeight() - config.bumpHeightValue);
}

public void bumpPivotRight() {
setDesiredPivotAngle(getCurrentPivotAngle() + config.bumpPivotValue);
}

public void bumpPivotLeft() {
setDesiredPivotAngle(getCurrentPivotAngle() - config.bumpPivotValue);
}

public void setPivotPower(double pivotPower) {
pivotMotor.set(pivotPower);
}
Expand Down