Skip to content

Commit

Permalink
Safe Lift Height (#72)
Browse files Browse the repository at this point in the history
* Co-authored-by: Owen-Zeng <[email protected]>

* Safe Height Constant Change

---------

Co-authored-by: Awang70 <[email protected]>
Co-authored-by: BenG49 <[email protected]>
  • Loading branch information
3 people authored Mar 12, 2024
1 parent 8ce92ee commit 2013ed0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
"open": true
},
"SmartDashboard": {
"Amper": {
"open": true
},
"Climber": {
"open": true
},
"Shooter": {
"open": true
},
Expand All @@ -90,6 +96,7 @@
},
"Server": {
"open": true
}
},
"visible": true
}
}
3 changes: 2 additions & 1 deletion src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,14 @@ private void configureOperatorBindings() {
operator.getDPadLeft()
.onTrue(new GandalfToAmp())
.onFalse(new ConveyorStop());


operator.getRightButton()
.onTrue(new AmperToHeight(Settings.Amper.Lift.AMP_SCORE_HEIGHT));
operator.getLeftButton()
.onTrue(new AmperToHeight(Settings.Amper.Lift.TRAP_SCORE_HEIGHT));
operator.getBottomButton()
.onTrue(new AmperToHeight(Settings.Amper.Lift.MIN_HEIGHT));
.onTrue(new AmperToHeight(Settings.Amper.Lift.MIN_HEIGHT));

// human player attention button
operator.getRightMenuButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.stuypulse.stuylib.streams.numbers.IStream;

import com.stuypulse.robot.constants.Settings;
import com.stuypulse.robot.subsystems.amper.Amper;
import com.stuypulse.robot.subsystems.climber.Climber;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
Expand All @@ -34,6 +35,10 @@ public void execute() {
climber.setVoltageOverride(voltage.get());

SmartDashboard.putNumber("Climber/Gamepad Voltage", voltage.get());

if (voltage.get() < 0){
Amper.getInstance().setTargetHeight(Settings.Amper.Lift.SAFE_CLIMB_HEIGHT);
}
}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/stuypulse/robot/constants/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public interface Lift {
double CARRIAGE_MASS = 10; // kg

double MIN_HEIGHT = 0;
double SAFE_CLIMB_HEIGHT = Units.inchesToMeters(2);
double MAX_HEIGHT = Units.inchesToMeters(22.0); // amp 14.75

double VISUALIZATION_MIN_LENGTH = 0.5;
Expand Down

0 comments on commit 2013ed0

Please sign in to comment.