Skip to content

Commit

Permalink
Fix pos/vel mixup in sim encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Apr 20, 2020
1 parent bab8af4 commit 13fc50f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ abstract class AbstractFalconEncoder<K : SIKey>(
private val simPositionHandle: SimDouble? = simDevice?.createDouble("Position, ${units::class.java.simpleName}s", false, 0.0)
private val simVelocityHandle: SimDouble? = simDevice?.createDouble("Velocity, ${units::class.java.simpleName}s/s", false, 0.0)

override fun setSimulatedPosition(position: SIUnit<K>) {
simPositionHandle?.set(position.value)
override fun setSimulatedPosition(simPosition: SIUnit<K>) {
simPositionHandle?.set(simPosition.value)
}

override fun setSimulatedVelocity(velocity: SIUnit<Velocity<K>>) {
simVelocityHandle?.set(position.value)
override fun setSimulatedVelocity(simVelocity: SIUnit<Velocity<K>>) {
simVelocityHandle?.set(simVelocity.value)
}

override val position: SIUnit<K>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import org.ghrobotics.lib.mathematics.units.nativeunit.NativeUnitVelocity
interface FalconEncoder<K : SIKey> {

/**
* Sets the simulated [position] of this motor.
* Sets the simulated [simPosition] of this motor.
*/
fun setSimulatedPosition(position: SIUnit<K>)
fun setSimulatedPosition(simPosition: SIUnit<K>)

/**
* Sets the simulated [velocity] of this motor.
* Sets the simulated [simVelocity] of this motor.
*/
fun setSimulatedVelocity(velocity: SIUnit<Velocity<K>>)
fun setSimulatedVelocity(simVelocity: SIUnit<Velocity<K>>)

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

0 comments on commit 13fc50f

Please sign in to comment.