Package edu.wpi.first.wpilibj.simulation
Class AnalogEncoderSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.AnalogEncoderSim
public class AnalogEncoderSim extends Object
Class to control a simulated analog encoder.
-
Constructor Summary
Constructors Constructor Description AnalogEncoderSim(AnalogEncoder encoder)
Constructs from an AnalogEncoder object. -
Method Summary
Modifier and Type Method Description Rotation2d
getPosition()
Get the position as aRotation2d
.double
getTurns()
Get the simulated position.void
setPosition(Rotation2d angle)
Set the position using anRotation2d
.void
setTurns(double turns)
Set the position of the encoder.
-
Constructor Details
-
AnalogEncoderSim
Constructs from an AnalogEncoder object.- Parameters:
encoder
- AnalogEncoder to simulate
-
-
Method Details
-
setPosition
Set the position using anRotation2d
.- Parameters:
angle
- The angle.
-
setTurns
Set the position of the encoder.- Parameters:
turns
- The position.
-
getTurns
Get the simulated position.- Returns:
- The simulated position.
-
getPosition
Get the position as aRotation2d
.- Returns:
- The position as a
Rotation2d
.
-