mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[sim] Add HALSIM accessors for encoder rate and distance (#2467)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -104,6 +104,22 @@ public class EncoderSim {
|
||||
EncoderDataJNI.setSamplesToAverage(m_index, samplesToAverage);
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
EncoderDataJNI.setDistance(m_index, distance);
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return EncoderDataJNI.getDistance(m_index);
|
||||
}
|
||||
|
||||
public void setRate(double rate) {
|
||||
EncoderDataJNI.setRate(m_index, rate);
|
||||
}
|
||||
|
||||
public double getRate() {
|
||||
return EncoderDataJNI.getRate(m_index);
|
||||
}
|
||||
|
||||
public void resetData() {
|
||||
EncoderDataJNI.resetData(m_index);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -51,5 +51,10 @@ public class EncoderDataJNI extends JNIWrapper {
|
||||
public static native int getSamplesToAverage(int index);
|
||||
public static native void setSamplesToAverage(int index, int samplesToAverage);
|
||||
|
||||
public static native void setDistance(int index, double distance);
|
||||
public static native double getDistance(int index);
|
||||
public static native void setRate(int index, double rate);
|
||||
public static native double getRate(int index);
|
||||
|
||||
public static native void resetData(int index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user