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
All Methods Instance Methods Concrete Methods 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 Detail
-
AnalogEncoderSim
public AnalogEncoderSim(AnalogEncoder encoder)
Constructs from an AnalogEncoder object.- Parameters:
encoder
- AnalogEncoder to simulate
-
-
Method Detail
-
setPosition
public void setPosition(Rotation2d angle)
Set the position using anRotation2d
.- Parameters:
angle
- The angle.
-
setTurns
public void setTurns(double turns)
Set the position of the encoder.- Parameters:
turns
- The position.
-
getTurns
public double getTurns()
Get the simulated position.- Returns:
- The simulated position.
-
getPosition
public Rotation2d getPosition()
Get the position as aRotation2d
.- Returns:
- The position as a
Rotation2d
.
-
-