@@ -186,7 +186,7 @@ public Builder tolerance(double errorTolerance, double errorDerivativeTolerance)
186186 }
187187
188188 /**
189- * Sets the low and high values for the output.
189+ * Sets the low and high values for the output to use when PID control is enabled .
190190 *
191191 * @param low The lower boundary to which to clamp output values.
192192 * @param high The higher boundary to which to clamp output values.
@@ -201,7 +201,7 @@ public Builder limits(double low, double high) {
201201 }
202202
203203 /**
204- * Sets the function to use to clamp output values.
204+ * Sets the function to use to clamp output values when PID control is enabled .
205205 *
206206 * @param clamper Function to use to clamp output values
207207 * @return {@code this} for chaining
@@ -393,6 +393,7 @@ private void periodic(RobotState robotState) {
393393 publishers .setpointPublisher .set (getSetpoint ().in (rotationUnit ));
394394 publishers .atSetpointPublisher .set (atSetpoint ());
395395 publishers .appliedCurrentPublisher .set (motor .getAppliedCurrent ().in (Units .Amps ));
396+ publishers .pidControlEnabledPublisher .set (isPIDControlEnabled );
396397 }
397398 }
398399
@@ -411,14 +412,16 @@ private record Publishers(
411412 DoublePublisher positionPublisher ,
412413 BooleanPublisher atSetpointPublisher ,
413414 DoublePublisher appliedCurrentPublisher ,
414- DoublePublisher setpointPublisher ) {
415+ DoublePublisher setpointPublisher ,
416+ BooleanPublisher pidControlEnabledPublisher ) {
415417
416418 Publishers (NetworkTable networkTable ) {
417419 this (
418420 networkTable .getDoubleTopic ("position" ).publish (),
419421 networkTable .getBooleanTopic ("at setpoint" ).publish (),
420422 networkTable .getDoubleTopic ("applied current" ).publish (),
421- networkTable .getDoubleTopic ("setpoint" ).publish ());
423+ networkTable .getDoubleTopic ("setpoint" ).publish (),
424+ networkTable .getBooleanTopic ("PID control enabled" ).publish ());
422425 }
423426
424427 void close () {
0 commit comments