Skip to content

Commit

Permalink
make ktlint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
jpothen8 committed Apr 16, 2024
1 parent 770dbb2 commit 4d717ef
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/main/kotlin/frc/team449/control/vision/VisionEstimator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ class VisionEstimator(
var usedTarget: PhotonTrackedTarget? = null
for (target: PhotonTrackedTarget in result.targets) {
if (target.fiducialId == 4 && DriverStation.getAlliance().getOrNull() == DriverStation.Alliance.Red ||
target.fiducialId == 7 && DriverStation.getAlliance().getOrNull() == DriverStation.Alliance.Blue) {
target.fiducialId == 7 && DriverStation.getAlliance().getOrNull() == DriverStation.Alliance.Blue
) {
usedTarget = target
}
}
Expand All @@ -199,7 +200,6 @@ class VisionEstimator(
// targets.
val targetPosition = tagLayout.getTagPose(usedTarget.fiducialId)


val bestPose = targetPosition
.get()
.transformBy(
Expand All @@ -209,11 +209,11 @@ class VisionEstimator(

if (abs(
MathUtil.angleModulus(
MathUtil.angleModulus(bestPose.rotation.z) -
MathUtil.angleModulus(driveHeading!!.radians)
)
MathUtil.angleModulus(bestPose.rotation.z) -
MathUtil.angleModulus(driveHeading!!.radians)
)
)
> VisionConstants.SINGLE_TAG_HEADING_MAX_DEV_RAD
> VisionConstants.SINGLE_TAG_HEADING_MAX_DEV_RAD
) {
DriverStation.reportWarning("Best Single Tag Heading over Max Deviation, deviated by ${Units.radiansToDegrees(abs(bestPose.rotation.z - driveHeading!!.radians))}", false)
return Optional.empty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class ControllerBindings(
stopAll()
.alongWith(robot.pivot.moveStow())
)
)//.onFalse(
) // .onFalse(
// robot.feeder.intake()
// .alongWith(
// robot.shooter.scoreAmp(),
Expand Down Expand Up @@ -290,7 +290,7 @@ class ControllerBindings(
.withTimeout(FeederConstants.CHECK_NOTE_IN_LOCATION_TIMEOUT_SECONDS)
.andThen(checkNoteInLocation())
)
)//.onFalse(
) // .onFalse(
// SequentialCommandGroup(
// slowIntake(),
// outtakeToNotePosition()
Expand Down
26 changes: 22 additions & 4 deletions src/main/kotlin/frc/team449/robot2024/subsystems/pivot/Pivot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,41 @@ open class Pivot(

private fun getSlowVoltage(): Double {
return MathUtil.clamp(
controller.getU(0) + feedforward.getUff(0) - observer.getXhat(2) + PivotConstants.SIMPLE_FF.calculate(lastProfileReference.position + PivotConstants.KG_OFFSET, lastProfileReference.velocity),
-PivotConstants.MAX_VOLTAGE,
controller.getU(0) +
feedforward.getUff(0) -
observer.getXhat(2) +
PivotConstants.SIMPLE_FF.calculate(
lastProfileReference.position + PivotConstants.KG_OFFSET,
lastProfileReference.velocity
),
-PivotConstants.MAX_VOLTAGE,
PivotConstants.MAX_VOLTAGE
)
}

private fun getFastVoltage(): Double {
return MathUtil.clamp(
fastController.getU(0) + feedforward.getUff(0) - observer.getXhat(2) + PivotConstants.SIMPLE_FF.calculate(lastProfileReference.position + PivotConstants.KG_OFFSET, lastProfileReference.velocity),
fastController.getU(0) +
feedforward.getUff(0) -
observer.getXhat(2) +
PivotConstants.SIMPLE_FF.calculate(
lastProfileReference.position + PivotConstants.KG_OFFSET,
lastProfileReference.velocity
),
-PivotConstants.MAX_VOLTAGE,
PivotConstants.MAX_VOLTAGE
)
}

private fun getAutoVoltage(): Double {
return MathUtil.clamp(
autoController.getU(0) + feedforward.getUff(0) - observer.getXhat(2) + PivotConstants.SIMPLE_FF.calculate(lastProfileReference.position + PivotConstants.KG_OFFSET, lastProfileReference.velocity),
autoController.getU(0) +
feedforward.getUff(0) -
observer.getXhat(2) +
PivotConstants.SIMPLE_FF.calculate(
lastProfileReference.position + PivotConstants.KG_OFFSET,
lastProfileReference.velocity
),
-PivotConstants.MAX_VOLTAGE,
PivotConstants.MAX_VOLTAGE
)
Expand Down

0 comments on commit 4d717ef

Please sign in to comment.