mirror of
https://github.com/Team4388/2025RidgeScape.git
synced 2026-06-09 00:38:02 -06:00
End of 2nd day utah
This commit is contained in:
@@ -305,6 +305,7 @@ public final class Constants {
|
||||
// public static final Gains ROT_GAINS = new Gains(0.05,0,0.0);
|
||||
|
||||
public static final Trim X_OFFSET_TRIM = new Trim("X Offset Trim", Double.MAX_VALUE, -Double.MAX_VALUE,0.5, 0);
|
||||
// public static final Trim Y_OFFSET_TRIM = new Trim("Y Offset Trim", Double.MAX_VALUE, -Double.MAX_VALUE, 0.5, 1.5);
|
||||
public static final Trim Y_OFFSET_TRIM = new Trim("Y Offset Trim", Double.MAX_VALUE, -Double.MAX_VALUE, 0.5, 0);
|
||||
public static final Trim ELEVATOR_OFFSET_TRIM = new Trim("Elevator Offset Trim", -ElevatorConstants.MAX_POSITION_ELEVATOR, ElevatorConstants.MAX_POSITION_ELEVATOR, 1, 0);
|
||||
public static final Trim ARM_OFFSET_TRIM = new Trim("ARM Offset Trim", -ElevatorConstants.COMPLETLY_TOP_ENDEFFECTOR, ElevatorConstants.COMPLETLY_TOP_ENDEFFECTOR, 1, 0);
|
||||
@@ -319,14 +320,15 @@ public final class Constants {
|
||||
|
||||
// X is tangent to reef side
|
||||
// Y is normal to reef side
|
||||
public static final double X_SCORING_POSITION_OFFSET = Units.inchesToMeters(6.5); // This is from the field
|
||||
public static final double Y_SCORING_POSITION_OFFSET = Units.inchesToMeters(16);
|
||||
public static final double X_SCORING_POSITION_OFFSET = Units.inchesToMeters(6.5+1); // This is from the field
|
||||
public static final double Y_SCORING_POSITION_OFFSET = Units.inchesToMeters(16+1);
|
||||
|
||||
public static final double L4_DISTANCE_PREP = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(15);
|
||||
public static final double L4_DISTANCE_SCORE = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(5.5);
|
||||
// public static final double L4_DISTANCE_SCORE = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(4.5);
|
||||
|
||||
public static final double L3_DISTANCE_PREP = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(15);
|
||||
public static final double L3_DISTANCE_SCORE = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(5);
|
||||
public static final double L3_DISTANCE_SCORE = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(5+1);
|
||||
|
||||
public static final double L2_PREP_DISTANCE = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(6);
|
||||
public static final double L2_SCORE_DISTANCE = Y_SCORING_POSITION_OFFSET + Units.inchesToMeters(0.5);
|
||||
|
||||
@@ -511,10 +511,10 @@ public class RobotContainer {
|
||||
|
||||
// While Left Trigger Pressed: Trims
|
||||
new Trigger(() -> getDeadbandedDriverController().getPOV() == 0 && getDeadbandedDriverController().getLeftTriggerAxis() > 0.8)
|
||||
.onTrue(new InstantCommand(() -> AutoConstants.Y_OFFSET_TRIM.stepUp()));
|
||||
.onTrue(new InstantCommand(() -> AutoConstants.Y_OFFSET_TRIM.stepDown()));
|
||||
|
||||
new Trigger(() -> getDeadbandedDriverController().getPOV() == 180 && getDeadbandedDriverController().getLeftTriggerAxis() > 0.8)
|
||||
.onTrue(new InstantCommand(() -> AutoConstants.Y_OFFSET_TRIM.stepDown()));
|
||||
.onTrue(new InstantCommand(() -> AutoConstants.Y_OFFSET_TRIM.stepUp()));
|
||||
|
||||
new Trigger(() -> getDeadbandedDriverController().getPOV() == 90 && getDeadbandedDriverController().getLeftTriggerAxis() > 0.8)
|
||||
.onTrue(new InstantCommand(() -> AutoConstants.X_OFFSET_TRIM.stepUp()));
|
||||
|
||||
@@ -81,21 +81,22 @@ public class Trim {
|
||||
}
|
||||
|
||||
public boolean load() {
|
||||
try (FileInputStream stream = new FileInputStream("/home/lvuser/trims/" + trimName)) {
|
||||
double fileValue = DataUtils.byteArrayToDouble(stream.readNBytes(8));
|
||||
currentValue = fileValue;
|
||||
clampModify();
|
||||
modified = false;
|
||||
if (fileValue != currentValue) {
|
||||
System.out.println("TRIMS: Loaded trim `" + trimName + "` has a value that is higher than or less than the bounds set for the trim, clamping...");
|
||||
modified = true;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
System.out.println("TRIMS: Unable to read trim file `" + trimName + "`, using current value...");
|
||||
return false;
|
||||
}
|
||||
// try (FileInputStream stream = new FileInputStream("/home/lvuser/trims/" + trimName)) {
|
||||
// double fileValue = DataUtils.byteArrayToDouble(stream.readNBytes(8));
|
||||
// currentValue = fileValue;
|
||||
// clampModify();
|
||||
// modified = false;
|
||||
// if (fileValue != currentValue) {
|
||||
// System.out.println("TRIMS: Loaded trim `" + trimName + "` has a value that is higher than or less than the bounds set for the trim, clamping...");
|
||||
// modified = true;
|
||||
// }
|
||||
// return true;
|
||||
// } catch (Exception e) {
|
||||
// // e.printStackTrace();
|
||||
// System.out.println("TRIMS: Unable to read trim file `" + trimName + "`, using current value...");
|
||||
// return false;
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
public void dump() {
|
||||
|
||||
Reference in New Issue
Block a user