Skip to content

Commit

Permalink
fix: units bug causing swerve to drive slow
Browse files Browse the repository at this point in the history
  • Loading branch information
drive station committed Feb 20, 2025
1 parent 39cce06 commit 4ce51f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 4ce51f4

Please sign in to comment.