From 4ce51f4b73bb4f24df2641d37d8a90c4e867cbba Mon Sep 17 00:00:00 2001 From: drive station Date: Wed, 19 Feb 2025 16:03:46 -0800 Subject: [PATCH] fix: units bug causing swerve to drive slow --- .../com/frcteam3636/frc2025/subsystems/drivetrain/Module.kt | 6 +++--- .../frc2025/subsystems/manipulator/Manipulator.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/frcteam3636/frc2025/subsystems/drivetrain/Module.kt b/src/main/kotlin/com/frcteam3636/frc2025/subsystems/drivetrain/Module.kt index 7f03620..ab1c22f 100644 --- a/src/main/kotlin/com/frcteam3636/frc2025/subsystems/drivetrain/Module.kt +++ b/src/main/kotlin/com/frcteam3636/frc2025/subsystems/drivetrain/Module.kt @@ -141,16 +141,16 @@ class DrivingTalon(id: CTREDeviceId) : DrivingMotor { } override val position: Distance - get() = inner.position.value.toLinear(WHEEL_CIRCUMFERENCE) * DRIVING_GEAR_RATIO_TALON + get() = inner.position.value.toLinear(WHEEL_RADIUS) * DRIVING_GEAR_RATIO_TALON private var velocityControl = VelocityVoltage(0.0).apply { EnableFOC = true } override var velocity: LinearVelocity - get() = (inner.velocity.value.inRotationsPerSecond() * DRIVING_GEAR_RATIO_TALON * WHEEL_CIRCUMFERENCE.inMeters()).metersPerSecond + get() = inner.velocity.value.toLinear(WHEEL_RADIUS) * DRIVING_GEAR_RATIO_TALON set(value) { - inner.setControl(velocityControl.withVelocity(value.inMetersPerSecond() / DRIVING_GEAR_RATIO_TALON / WHEEL_CIRCUMFERENCE.inMeters())) + inner.setControl(velocityControl.withVelocity(value.toAngular(WHEEL_RADIUS) / DRIVING_GEAR_RATIO_TALON)) } private val voltageControl = VoltageOut(0.0).apply { diff --git a/src/main/kotlin/com/frcteam3636/frc2025/subsystems/manipulator/Manipulator.kt b/src/main/kotlin/com/frcteam3636/frc2025/subsystems/manipulator/Manipulator.kt index efe5cf8..d6903c0 100644 --- a/src/main/kotlin/com/frcteam3636/frc2025/subsystems/manipulator/Manipulator.kt +++ b/src/main/kotlin/com/frcteam3636/frc2025/subsystems/manipulator/Manipulator.kt @@ -36,7 +36,7 @@ object Manipulator : Subsystem { LoggedMechanismLigament2d("Manipulator Motor Angle", 40.0, 0.0, 5.0, Color8Bit(Color.kRed)) private fun waitForIntake(): Command = Commands.sequence( - Commands.waitUntil { inputs.current > 0.85.amps }, + Commands.waitUntil { inputs.current > 0.8.amps }, Commands.defer({ val targetRotations = inputs.position + 1.175.rotations Commands.waitUntil { inputs.position > targetRotations }