[wpilib] DutyCycleEncoderSim: Expand API (#5443)

This commit is contained in:
Gold856
2023-07-19 20:24:09 -04:00
committed by GitHub
parent 657338715d
commit 72a4543493
7 changed files with 257 additions and 3 deletions

View File

@@ -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