mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
PIDController now supports composition (#976)
For example, an outer position feedback controller can now drive the reference of an inner velocity feedback controller.
This commit is contained in:
committed by
Peter Johnson
parent
5cc7573574
commit
df182f382e
@@ -528,6 +528,18 @@ void PIDBase::Reset() {
|
||||
m_result = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes the output directly to SetSetpoint().
|
||||
*
|
||||
* PIDControllers can be nested by passing a PIDController as another
|
||||
* PIDController's output. In that case, the output of the parent controller
|
||||
* becomes the input (i.e., the reference) of the child.
|
||||
*
|
||||
* It is the caller's responsibility to put the data into a valid form for
|
||||
* SetSetpoint().
|
||||
*/
|
||||
void PIDBase::PIDWrite(double output) { SetSetpoint(output); }
|
||||
|
||||
void PIDBase::InitSendable(SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("PIDBase");
|
||||
builder.SetSafeState([=]() { Reset(); });
|
||||
|
||||
Reference in New Issue
Block a user