Skip to content

Commit bd98958

Browse files
committed
fixed logic issue and added d to arm pid
1 parent f327b94 commit bd98958

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/frc/trigon/robot/subsystems/arm/ArmConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private static void configureArmMasterMotor() {
144144

145145
config.Slot0.kP = RobotHardwareStats.isSimulation() ? 100 : 0;
146146
config.Slot0.kI = RobotHardwareStats.isSimulation() ? 0 : 0;
147-
config.Slot0.kD = RobotHardwareStats.isSimulation() ? 0 : 0;
147+
config.Slot0.kD = RobotHardwareStats.isSimulation() ? 1 : 0;
148148
config.Slot0.kS = RobotHardwareStats.isSimulation() ? 0.026331 : 0;
149149
config.Slot0.kV = RobotHardwareStats.isSimulation() ? 4.8752 : 0;
150150
config.Slot0.kA = RobotHardwareStats.isSimulation() ? 0.17848 : 0;

src/main/java/frc/trigon/robot/subsystems/elevator/Elevator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void setTargetState(ElevatorConstants.ElevatorState targetState) {
9898
}
9999

100100
void setTargetPositionRotations(double targetPositionRotations) {
101-
double minimumSafeHeightMeters = RobotContainer.ARM.isArmAboveSafeZone() ? 0 : Math.cos(RobotContainer.ARM.getAngle().getDegrees()) * ArmConstants.ARM_LENGTH_METERS + ElevatorConstants.MINIMUM_ELEVATOR_SAFE_ZONE_METERS;
101+
double minimumSafeHeightMeters = RobotContainer.ARM.isArmAboveSafeZone() ? 0 : Math.cos(RobotContainer.ARM.getAngle().getRadians()) * ArmConstants.ARM_LENGTH_METERS + ElevatorConstants.MINIMUM_ELEVATOR_SAFE_ZONE_METERS;
102102
double minimumSafeHeightRotations = metersToRotations(minimumSafeHeightMeters);
103103
masterMotor.setControl(positionRequest.withPosition(Math.max(targetPositionRotations, minimumSafeHeightRotations)));
104104
}

0 commit comments

Comments
 (0)