mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[hal, wpilib] Remove analog accumulator and analog gyro (#7697)
The 2 high level classes were temporarily kept to keep the examples compiling. We will remove those when we have the interface into the built in IMU.
This commit is contained in:
@@ -6,7 +6,6 @@ package edu.wpi.first.wpilibj;
|
||||
|
||||
import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;
|
||||
|
||||
import edu.wpi.first.hal.AnalogGyroJNI;
|
||||
import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.math.geometry.Rotation2d;
|
||||
@@ -24,20 +23,11 @@ import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
* <p>This class is for gyro sensors that connect to an analog input.
|
||||
*/
|
||||
public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
private static final double kDefaultVoltsPerDegreePerSecond = 0.007;
|
||||
private AnalogInput m_analog;
|
||||
private boolean m_channelAllocated;
|
||||
|
||||
private int m_gyroHandle;
|
||||
|
||||
/** Initialize the gyro. Calibration is handled by calibrate(). */
|
||||
private void initGyro() {
|
||||
if (m_gyroHandle == 0) {
|
||||
m_gyroHandle = AnalogGyroJNI.initializeAnalogGyro(m_analog.m_port);
|
||||
}
|
||||
|
||||
AnalogGyroJNI.setupAnalogGyro(m_gyroHandle);
|
||||
|
||||
HAL.report(tResourceType.kResourceType_Gyro, m_analog.getChannel() + 1);
|
||||
SendableRegistry.addLW(this, "AnalogGyro", m_analog.getChannel());
|
||||
}
|
||||
@@ -50,9 +40,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
* are in progress, this is typically done when the robot is first turned on while it's sitting at
|
||||
* rest before the competition starts.
|
||||
*/
|
||||
public void calibrate() {
|
||||
AnalogGyroJNI.calibrateAnalogGyro(m_gyroHandle);
|
||||
}
|
||||
public void calibrate() {}
|
||||
|
||||
/**
|
||||
* Return the heading of the robot as a {@link edu.wpi.first.math.geometry.Rotation2d}.
|
||||
@@ -126,15 +114,12 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
* @param center Preset uncalibrated value to use as the accumulator center value.
|
||||
* @param offset Preset uncalibrated value to use as the gyro offset.
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
@SuppressWarnings({"this-escape", "PMD.UnusedFormalParameter"})
|
||||
public AnalogGyro(AnalogInput channel, int center, double offset) {
|
||||
requireNonNullParam(channel, "channel", "AnalogGyro");
|
||||
|
||||
m_analog = channel;
|
||||
initGyro();
|
||||
AnalogGyroJNI.setAnalogGyroParameters(
|
||||
m_gyroHandle, kDefaultVoltsPerDegreePerSecond,
|
||||
offset, center);
|
||||
reset();
|
||||
}
|
||||
|
||||
@@ -144,9 +129,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
* <p>Resets the gyro to a heading of zero. This can be used if there is significant drift in the
|
||||
* gyro, and it needs to be recalibrated after it has been running.
|
||||
*/
|
||||
public void reset() {
|
||||
AnalogGyroJNI.resetAnalogGyro(m_gyroHandle);
|
||||
}
|
||||
public void reset() {}
|
||||
|
||||
/** Delete (free) the accumulator and the analog components used for the gyro. */
|
||||
@Override
|
||||
@@ -156,7 +139,6 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
m_analog.close();
|
||||
}
|
||||
m_analog = null;
|
||||
AnalogGyroJNI.freeAnalogGyro(m_gyroHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,11 +156,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
* @return the current heading of the robot in degrees.
|
||||
*/
|
||||
public double getAngle() {
|
||||
if (m_analog == null) {
|
||||
return 0.0;
|
||||
} else {
|
||||
return AnalogGyroJNI.getAnalogGyroAngle(m_gyroHandle);
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,11 +170,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
* @return the current rate in degrees per second
|
||||
*/
|
||||
public double getRate() {
|
||||
if (m_analog == null) {
|
||||
return 0.0;
|
||||
} else {
|
||||
return AnalogGyroJNI.getAnalogGyroRate(m_gyroHandle);
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +179,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
* @return the current offset value
|
||||
*/
|
||||
public double getOffset() {
|
||||
return AnalogGyroJNI.getAnalogGyroOffset(m_gyroHandle);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,7 +188,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
* @return the current center value
|
||||
*/
|
||||
public int getCenter() {
|
||||
return AnalogGyroJNI.getAnalogGyroCenter(m_gyroHandle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,9 +198,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
*
|
||||
* @param voltsPerDegreePerSecond The sensitivity in Volts/degree/second.
|
||||
*/
|
||||
public void setSensitivity(double voltsPerDegreePerSecond) {
|
||||
AnalogGyroJNI.setAnalogGyroVoltsPerDegreePerSecond(m_gyroHandle, voltsPerDegreePerSecond);
|
||||
}
|
||||
public void setSensitivity(double voltsPerDegreePerSecond) {}
|
||||
|
||||
/**
|
||||
* Set the size of the neutral zone. Any voltage from the gyro less than this amount from the
|
||||
@@ -235,9 +207,7 @@ public class AnalogGyro implements Sendable, AutoCloseable {
|
||||
*
|
||||
* @param volts The size of the deadband in volts
|
||||
*/
|
||||
public void setDeadband(double volts) {
|
||||
AnalogGyroJNI.setAnalogGyroDeadband(m_gyroHandle, volts);
|
||||
}
|
||||
public void setDeadband(double volts) {}
|
||||
|
||||
/**
|
||||
* Gets the analog input for the gyro.
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.AccumulatorResult;
|
||||
import edu.wpi.first.hal.AnalogJNI;
|
||||
import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.hal.SimDevice;
|
||||
import edu.wpi.first.hal.util.AllocationException;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
@@ -27,11 +25,8 @@ import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
* number of samples to retain the resolution, but get more stable values.
|
||||
*/
|
||||
public class AnalogInput implements Sendable, AutoCloseable {
|
||||
private static final int kAccumulatorSlot = 1;
|
||||
int m_port; // explicit no modifier, private and package accessible.
|
||||
private int m_channel;
|
||||
private static final int[] kAccumulatorChannels = {0, 1};
|
||||
private long m_accumulatorOffset;
|
||||
|
||||
/**
|
||||
* Construct an analog channel.
|
||||
@@ -56,7 +51,6 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
AnalogJNI.freeAnalogInputPort(m_port);
|
||||
m_port = 0;
|
||||
m_channel = 0;
|
||||
m_accumulatorOffset = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,127 +175,6 @@ public class AnalogInput implements Sendable, AutoCloseable {
|
||||
return AnalogJNI.getAnalogOversampleBits(m_port);
|
||||
}
|
||||
|
||||
/** Initialize the accumulator. */
|
||||
public void initAccumulator() {
|
||||
if (!isAccumulatorChannel()) {
|
||||
throw new AllocationException(
|
||||
"Accumulators are only available on slot "
|
||||
+ kAccumulatorSlot
|
||||
+ " on channels "
|
||||
+ kAccumulatorChannels[0]
|
||||
+ ", "
|
||||
+ kAccumulatorChannels[1]);
|
||||
}
|
||||
m_accumulatorOffset = 0;
|
||||
AnalogJNI.initAccumulator(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an initial value for the accumulator.
|
||||
*
|
||||
* <p>This will be added to all values returned to the user.
|
||||
*
|
||||
* @param initialValue The value that the accumulator should start from when reset.
|
||||
*/
|
||||
public void setAccumulatorInitialValue(long initialValue) {
|
||||
m_accumulatorOffset = initialValue;
|
||||
}
|
||||
|
||||
/** Resets the accumulator to the initial value. */
|
||||
public void resetAccumulator() {
|
||||
AnalogJNI.resetAccumulator(m_port);
|
||||
|
||||
// Wait until the next sample, so the next call to getAccumulator*()
|
||||
// won't have old values.
|
||||
final double sampleTime = 1.0 / getGlobalSampleRate();
|
||||
final double overSamples = 1 << getOversampleBits();
|
||||
final double averageSamples = 1 << getAverageBits();
|
||||
Timer.delay(sampleTime * overSamples * averageSamples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the center value of the accumulator.
|
||||
*
|
||||
* <p>The center value is subtracted from each A/D value before it is added to the accumulator.
|
||||
* This is used for the center value of devices like gyros and accelerometers to take the device
|
||||
* offset into account when integrating.
|
||||
*
|
||||
* <p>This center value is based on the output of the oversampled and averaged source the
|
||||
* accumulator channel. Because of this, any non-zero oversample bits will affect the size of the
|
||||
* value for this field.
|
||||
*
|
||||
* @param center The accumulator's center value.
|
||||
*/
|
||||
public void setAccumulatorCenter(int center) {
|
||||
AnalogJNI.setAccumulatorCenter(m_port, center);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the accumulator's deadband.
|
||||
*
|
||||
* @param deadband The deadband size in ADC codes (12-bit value)
|
||||
*/
|
||||
public void setAccumulatorDeadband(int deadband) {
|
||||
AnalogJNI.setAccumulatorDeadband(m_port, deadband);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the accumulated value.
|
||||
*
|
||||
* <p>Read the value that has been accumulating. The accumulator is attached after the oversample
|
||||
* and average engine.
|
||||
*
|
||||
* @return The 64-bit value accumulated since the last Reset().
|
||||
*/
|
||||
public long getAccumulatorValue() {
|
||||
return AnalogJNI.getAccumulatorValue(m_port) + m_accumulatorOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the number of accumulated values.
|
||||
*
|
||||
* <p>Read the count of the accumulated values since the accumulator was last Reset().
|
||||
*
|
||||
* @return The number of times samples from the channel were accumulated.
|
||||
*/
|
||||
public long getAccumulatorCount() {
|
||||
return AnalogJNI.getAccumulatorCount(m_port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the accumulated value and the number of accumulated values atomically.
|
||||
*
|
||||
* <p>This function reads the value and count from the FPGA atomically. This can be used for
|
||||
* averaging.
|
||||
*
|
||||
* @param result AccumulatorResult object to store the results in.
|
||||
*/
|
||||
public void getAccumulatorOutput(AccumulatorResult result) {
|
||||
if (result == null) {
|
||||
throw new IllegalArgumentException("Null parameter `result'");
|
||||
}
|
||||
if (!isAccumulatorChannel()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Channel " + m_channel + " is not an accumulator channel.");
|
||||
}
|
||||
AnalogJNI.getAccumulatorOutput(m_port, result);
|
||||
result.value += m_accumulatorOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the channel attached to an accumulator.
|
||||
*
|
||||
* @return The analog channel is attached to an accumulator.
|
||||
*/
|
||||
public boolean isAccumulatorChannel() {
|
||||
for (int channel : kAccumulatorChannels) {
|
||||
if (m_channel == channel) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sample rate per channel.
|
||||
*
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.first.wpilibj.simulation;
|
||||
|
||||
import edu.wpi.first.hal.simulation.AnalogGyroDataJNI;
|
||||
import edu.wpi.first.hal.simulation.NotifyCallback;
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
|
||||
/** Class to control a simulated analog gyro. */
|
||||
public class AnalogGyroSim {
|
||||
private final int m_index;
|
||||
|
||||
/**
|
||||
* Constructs from an AnalogGyro object.
|
||||
*
|
||||
* @param gyro AnalogGyro to simulate
|
||||
*/
|
||||
public AnalogGyroSim(AnalogGyro gyro) {
|
||||
m_index = gyro.getAnalogInput().getChannel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs from an analog input channel number.
|
||||
*
|
||||
* @param channel Channel number
|
||||
*/
|
||||
public AnalogGyroSim(int channel) {
|
||||
m_index = channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on the angle.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the angle changes
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerAngleCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = AnalogGyroDataJNI.registerAngleCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogGyroDataJNI::cancelAngleCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current angle of the gyro.
|
||||
*
|
||||
* @return the angle measured by the gyro
|
||||
*/
|
||||
public double getAngle() {
|
||||
return AnalogGyroDataJNI.getAngle(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the angle measured by the gyro.
|
||||
*
|
||||
* @param angle the new value
|
||||
*/
|
||||
public void setAngle(double angle) {
|
||||
AnalogGyroDataJNI.setAngle(m_index, angle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on the rate.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the rate changes
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerRateCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = AnalogGyroDataJNI.registerRateCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogGyroDataJNI::cancelRateCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rate of angle change on this gyro.
|
||||
*
|
||||
* @return the rate
|
||||
*/
|
||||
public double getRate() {
|
||||
return AnalogGyroDataJNI.getRate(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the rate of the gyro.
|
||||
*
|
||||
* @param rate the new rate
|
||||
*/
|
||||
public void setRate(double rate) {
|
||||
AnalogGyroDataJNI.setRate(m_index, rate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on whether the gyro is initialized.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the gyro is initialized
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerInitializedCallback(NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = AnalogGyroDataJNI.registerInitializedCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogGyroDataJNI::cancelInitializedCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the gyro is initialized.
|
||||
*
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean getInitialized() {
|
||||
return AnalogGyroDataJNI.getInitialized(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether this gyro is initialized.
|
||||
*
|
||||
* @param initialized the new value
|
||||
*/
|
||||
public void setInitialized(boolean initialized) {
|
||||
AnalogGyroDataJNI.setInitialized(m_index, initialized);
|
||||
}
|
||||
|
||||
/** Reset all simulation data for this object. */
|
||||
public void resetData() {
|
||||
AnalogGyroDataJNI.resetData(m_index);
|
||||
}
|
||||
}
|
||||
@@ -151,162 +151,6 @@ public class AnalogInputSim {
|
||||
AnalogInDataJNI.setVoltage(m_index, voltage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on whether the accumulator is initialized.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the accumulator is initialized
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerAccumulatorInitializedCallback(
|
||||
NotifyCallback callback, boolean initialNotify) {
|
||||
int uid =
|
||||
AnalogInDataJNI.registerAccumulatorInitializedCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogInDataJNI::cancelAccumulatorInitializedCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the accumulator has been initialized.
|
||||
*
|
||||
* @return true if initialized
|
||||
*/
|
||||
public boolean getAccumulatorInitialized() {
|
||||
return AnalogInDataJNI.getAccumulatorInitialized(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change whether the accumulator has been initialized.
|
||||
*
|
||||
* @param accumulatorInitialized the new value
|
||||
*/
|
||||
public void setAccumulatorInitialized(boolean accumulatorInitialized) {
|
||||
AnalogInDataJNI.setAccumulatorInitialized(m_index, accumulatorInitialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on the accumulator value.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the accumulator value is changed.
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerAccumulatorValueCallback(
|
||||
NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = AnalogInDataJNI.registerAccumulatorValueCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogInDataJNI::cancelAccumulatorValueCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the accumulator value.
|
||||
*
|
||||
* @return the accumulator value
|
||||
*/
|
||||
public long getAccumulatorValue() {
|
||||
return AnalogInDataJNI.getAccumulatorValue(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the accumulator value.
|
||||
*
|
||||
* @param accumulatorValue the new value
|
||||
*/
|
||||
public void setAccumulatorValue(long accumulatorValue) {
|
||||
AnalogInDataJNI.setAccumulatorValue(m_index, accumulatorValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on the accumulator count.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the accumulator count is changed.
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerAccumulatorCountCallback(
|
||||
NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = AnalogInDataJNI.registerAccumulatorCountCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogInDataJNI::cancelAccumulatorCountCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the accumulator count.
|
||||
*
|
||||
* @return the accumulator count.
|
||||
*/
|
||||
public long getAccumulatorCount() {
|
||||
return AnalogInDataJNI.getAccumulatorCount(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the accumulator count.
|
||||
*
|
||||
* @param accumulatorCount the new count.
|
||||
*/
|
||||
public void setAccumulatorCount(long accumulatorCount) {
|
||||
AnalogInDataJNI.setAccumulatorCount(m_index, accumulatorCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on the accumulator center.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the accumulator center is changed
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerAccumulatorCenterCallback(
|
||||
NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = AnalogInDataJNI.registerAccumulatorCenterCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogInDataJNI::cancelAccumulatorCenterCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the accumulator center.
|
||||
*
|
||||
* @return the accumulator center
|
||||
*/
|
||||
public int getAccumulatorCenter() {
|
||||
return AnalogInDataJNI.getAccumulatorCenter(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the accumulator center.
|
||||
*
|
||||
* @param accumulatorCenter the new center
|
||||
*/
|
||||
public void setAccumulatorCenter(int accumulatorCenter) {
|
||||
AnalogInDataJNI.setAccumulatorCenter(m_index, accumulatorCenter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on the accumulator deadband.
|
||||
*
|
||||
* @param callback the callback that will be called whenever the accumulator deadband is changed
|
||||
* @param initialNotify if true, the callback will be run on the initial value
|
||||
* @return the {@link CallbackStore} object associated with this callback.
|
||||
*/
|
||||
public CallbackStore registerAccumulatorDeadbandCallback(
|
||||
NotifyCallback callback, boolean initialNotify) {
|
||||
int uid = AnalogInDataJNI.registerAccumulatorDeadbandCallback(m_index, callback, initialNotify);
|
||||
return new CallbackStore(m_index, uid, AnalogInDataJNI::cancelAccumulatorDeadbandCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the accumulator deadband.
|
||||
*
|
||||
* @return the accumulator deadband
|
||||
*/
|
||||
public int getAccumulatorDeadband() {
|
||||
return AnalogInDataJNI.getAccumulatorDeadband(m_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the accumulator deadband.
|
||||
*
|
||||
* @param accumulatorDeadband the new deadband
|
||||
*/
|
||||
public void setAccumulatorDeadband(int accumulatorDeadband) {
|
||||
AnalogInDataJNI.setAccumulatorDeadband(m_index, accumulatorDeadband);
|
||||
}
|
||||
|
||||
/** Reset all simulation data for this object. */
|
||||
public void resetData() {
|
||||
AnalogInDataJNI.resetData(m_index);
|
||||
|
||||
Reference in New Issue
Block a user