mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
artf4127: Implemented velocity PID controller
Change-Id: I8c0f84422f7ca0ac5c50fddb282fb3452ee1d491
This commit is contained in:
@@ -31,6 +31,7 @@ public class AnalogInput extends SensorBase implements PIDSource,
|
||||
|
||||
private SimFloatInput m_impl;
|
||||
private int m_channel;
|
||||
protected PIDSourceParameter m_pidSource = PIDSourceParameter.kDistance;
|
||||
|
||||
/**
|
||||
* Construct an analog channel.
|
||||
@@ -87,6 +88,20 @@ public class AnalogInput extends SensorBase implements PIDSource,
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void setPIDSourceParameter(PIDSourceParameter pidSource) {
|
||||
m_pidSource = pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public PIDSourceParameter getPIDSourceParameter() {
|
||||
return m_pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the average value for use with PIDController
|
||||
*
|
||||
|
||||
@@ -21,6 +21,7 @@ public class AnalogPotentiometer implements Potentiometer, LiveWindowSendable {
|
||||
private double m_scale, m_offset;
|
||||
private AnalogInput m_analog_input;
|
||||
private boolean m_init_analog_input;
|
||||
protected PIDSourceParameter m_pidSource = PIDSourceParameter.kDistance;
|
||||
|
||||
/**
|
||||
* Common initialization code called by all constructors.
|
||||
@@ -134,6 +135,20 @@ public class AnalogPotentiometer implements Potentiometer, LiveWindowSendable {
|
||||
return m_analog_input.getVoltage() * m_scale + m_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void setPIDSourceParameter(PIDSourceParameter pidSource) {
|
||||
m_pidSource = pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public PIDSourceParameter getPIDSourceParameter() {
|
||||
return m_pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the PIDSource interface.
|
||||
*
|
||||
|
||||
@@ -280,6 +280,13 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW
|
||||
m_pidSource = pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public PIDSourceParameter getPIDSourceParameter() {
|
||||
return m_pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the PIDSource interface.
|
||||
*
|
||||
|
||||
@@ -118,6 +118,13 @@ public class Gyro extends SensorBase implements PIDSource, LiveWindowSendable {
|
||||
m_pidSource = pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public PIDSourceParameter getPIDSourceParameter() {
|
||||
return m_pidSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the angle of the gyro for use with PIDControllers
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user