mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Add simple motor simulation classes (#1117)
This commit is contained in:
committed by
Peter Johnson
parent
57fc614074
commit
76c901ce78
@@ -123,6 +123,21 @@ class EncoderSim {
|
||||
HALSIM_SetEncoderSamplesToAverage(m_index, samplesToAverage);
|
||||
}
|
||||
|
||||
std::unique_ptr<CallbackStore> RegisterDistancePerPulseCallback(
|
||||
NotifyCallback callback, bool initialNotify) {
|
||||
auto store = std::make_unique<CallbackStore>(
|
||||
m_index, -1, callback, &HALSIM_CancelEncoderDistancePerPulseCallback);
|
||||
store->SetUid(HALSIM_RegisterEncoderDistancePerPulseCallback(
|
||||
m_index, &CallbackStoreThunk, store.get(), initialNotify));
|
||||
return store;
|
||||
}
|
||||
double GetDistancePerPulse() {
|
||||
return HALSIM_GetEncoderDistancePerPulse(m_index);
|
||||
}
|
||||
void SetDistancePerPulse(double distancePerPulse) {
|
||||
HALSIM_SetEncoderDistancePerPulse(m_index, distancePerPulse);
|
||||
}
|
||||
|
||||
void ResetData() { HALSIM_ResetEncoderData(m_index); }
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user