Skip to content

Commit 13fc50f

Browse files
committed
Fix pos/vel mixup in sim encoder
1 parent bab8af4 commit 13fc50f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

wpi/src/main/kotlin/org/ghrobotics/lib/motors/AbstractFalconEncoder.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ abstract class AbstractFalconEncoder<K : SIKey>(
2525
private val simPositionHandle: SimDouble? = simDevice?.createDouble("Position, ${units::class.java.simpleName}s", false, 0.0)
2626
private val simVelocityHandle: SimDouble? = simDevice?.createDouble("Velocity, ${units::class.java.simpleName}s/s", false, 0.0)
2727

28-
override fun setSimulatedPosition(position: SIUnit<K>) {
29-
simPositionHandle?.set(position.value)
28+
override fun setSimulatedPosition(simPosition: SIUnit<K>) {
29+
simPositionHandle?.set(simPosition.value)
3030
}
3131

32-
override fun setSimulatedVelocity(velocity: SIUnit<Velocity<K>>) {
33-
simVelocityHandle?.set(position.value)
32+
override fun setSimulatedVelocity(simVelocity: SIUnit<Velocity<K>>) {
33+
simVelocityHandle?.set(simVelocity.value)
3434
}
3535

3636
override val position: SIUnit<K>

wpi/src/main/kotlin/org/ghrobotics/lib/motors/FalconEncoder.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import org.ghrobotics.lib.mathematics.units.nativeunit.NativeUnitVelocity
1717
interface FalconEncoder<K : SIKey> {
1818

1919
/**
20-
* Sets the simulated [position] of this motor.
20+
* Sets the simulated [simPosition] of this motor.
2121
*/
22-
fun setSimulatedPosition(position: SIUnit<K>)
22+
fun setSimulatedPosition(simPosition: SIUnit<K>)
2323

2424
/**
25-
* Sets the simulated [velocity] of this motor.
25+
* Sets the simulated [simVelocity] of this motor.
2626
*/
27-
fun setSimulatedVelocity(velocity: SIUnit<Velocity<K>>)
27+
fun setSimulatedVelocity(simVelocity: SIUnit<Velocity<K>>)
2828

2929
/**
3030
* The velocity of the encoder in [K]/s. When in a simulation, returns the simulated velocity.

0 commit comments

Comments
 (0)