Package edu.wpi.first.wpilibj.simulation
Class DutyCycleEncoderSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.DutyCycleEncoderSim
public class DutyCycleEncoderSim extends Object
Class to control a simulated duty cycle encoder.
-
Constructor Summary
Constructors Constructor Description DutyCycleEncoderSim(int channel)
Constructs from a digital input channel.DutyCycleEncoderSim(DutyCycleEncoder encoder)
Constructs from an DutyCycleEncoder object. -
Method Summary
Modifier and Type Method Description double
get()
Get the position in turns.double
getAbsolutePosition()
Get the absolute position.boolean
getConnected()
Get if the encoder is connected.double
getDistance()
Get the distance.double
getDistancePerRotation()
Get the distance per rotation for this encoder.void
set(double turns)
Set the position in turns.void
setAbsolutePosition(double position)
Set the absolute position.void
setConnected(boolean isConnected)
Set if the encoder is connected.void
setDistance(double distance)
Set the distance.
-
Constructor Details
-
DutyCycleEncoderSim
Constructs from an DutyCycleEncoder object.- Parameters:
encoder
- DutyCycleEncoder to simulate
-
DutyCycleEncoderSim
Constructs from a digital input channel.- Parameters:
channel
- digital input channel.
-
-
Method Details
-
get
Get the position in turns.- Returns:
- The position.
-
set
Set the position in turns.- Parameters:
turns
- The position.
-
getDistance
Get the distance.- Returns:
- The distance.
-
setDistance
Set the distance.- Parameters:
distance
- The distance.
-
getAbsolutePosition
Get the absolute position.- Returns:
- The absolute position
-
setAbsolutePosition
Set the absolute position.- Parameters:
position
- The absolute position
-
getDistancePerRotation
Get the distance per rotation for this encoder.- Returns:
- The scale factor that will be used to convert rotation to useful units.
-
getConnected
Get if the encoder is connected.- Returns:
- true if the encoder is connected.
-
setConnected
Set if the encoder is connected.- Parameters:
isConnected
- Whether or not the sensor is connected.
-