mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpilib] DutyCycleEncoderSim: Expand API (#5443)
This commit is contained in:
@@ -32,6 +32,13 @@ class DutyCycleEncoderSim {
|
||||
*/
|
||||
explicit DutyCycleEncoderSim(int channel);
|
||||
|
||||
/**
|
||||
* Get the position in turns.
|
||||
*
|
||||
* @return The position.
|
||||
*/
|
||||
double Get();
|
||||
|
||||
/**
|
||||
* Set the position in turns.
|
||||
*
|
||||
@@ -40,13 +47,61 @@ class DutyCycleEncoderSim {
|
||||
void Set(units::turn_t turns);
|
||||
|
||||
/**
|
||||
* Set the position.
|
||||
* Get the distance.
|
||||
*
|
||||
* @return The distance.
|
||||
*/
|
||||
|
||||
double GetDistance();
|
||||
|
||||
/**
|
||||
* Set the distance.
|
||||
*
|
||||
* @param distance The distance.
|
||||
*/
|
||||
void SetDistance(double distance);
|
||||
|
||||
/**
|
||||
* Get the absolute position.
|
||||
*
|
||||
* @return The absolute position
|
||||
*/
|
||||
double GetAbsolutePosition();
|
||||
|
||||
/**
|
||||
* Set the absolute position.
|
||||
*
|
||||
* @param position The absolute position
|
||||
*/
|
||||
void SetAbsolutePosition(double position);
|
||||
|
||||
/**
|
||||
* Get the distance per rotation for this encoder.
|
||||
*
|
||||
* @return The scale factor that will be used to convert rotation to useful
|
||||
* units.
|
||||
*/
|
||||
double GetDistancePerRotation();
|
||||
|
||||
/**
|
||||
* Get if the encoder is connected.
|
||||
*
|
||||
* @return true if the encoder is connected.
|
||||
*/
|
||||
bool IsConnected();
|
||||
|
||||
/**
|
||||
* Set if the encoder is connected.
|
||||
*
|
||||
* @param isConnected Whether or not the sensor is connected.
|
||||
*/
|
||||
void SetConnected(bool isConnected);
|
||||
|
||||
private:
|
||||
hal::SimDouble m_simPosition;
|
||||
hal::SimDouble m_simDistancePerRotation;
|
||||
hal::SimDouble m_simAbsolutePosition;
|
||||
hal::SimBoolean m_simIsConnected;
|
||||
};
|
||||
|
||||
} // namespace sim
|
||||
|
||||
Reference in New Issue
Block a user