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 Rotation2dgetPosition()Get the position as aRotation2d.doublegetTurns()Get the simulated position.voidsetPosition(Rotation2d angle)Set the position using anRotation2d.voidsetTurns(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.
-