-
|
I am using this code to add a double variable to the network tables for viewing/updating in OutlineViewer: public void setSlot0_kP(double kP) @OverRide } The item displays as expected but changing the value in OV does not appear to call the setter function as the item value displayed does not change. Doc suggests this should work and I have used this in the past with Shuffleboard. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
Follow up: I can't set sendable values via OutlineViewer, Elastic or the NT viewer in sim. WPILib PID control does not update values either. I have tried everything I can think of but no joy. Tuning PID is supposed to be done this way but I'm not getting anywhere. |
Beta Was this translation helpful? Give feedback.
-
|
How are you publishing your |
Beta Was this translation helpful? Give feedback.
-
|
In addition to the above, how are you setting the value in OutlineViewer? The value isn't actually updated until you press enter; clicking away will discard the new value. The simple test code below appears to be working fine for me (on value change from OutlineViewer, a console line is printed and "Sendable inner value" updates). TestSendable.java: package frc.robot;
import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;
public class TestSendable implements Sendable {
private double value = 0;
public double getValue() {
return value;
}
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("TestSendable");
builder.addDoubleProperty(
"Value",
() -> value,
v -> {
System.out.println("Setter called with value: " + v);
this.value = v;
});
}
}Robot.java: ...
TestSendable sendable = new TestSendable();
public Robot() {
SmartDashboard.putData("Test Sendable", sendable);
}
@Override
public robotPeriodic() {
SmartDashboard.putNumber("Sendable inner value", sendable.getValue());
}
... |
Beta Was this translation helpful? Give feedback.
-
|
Your question about how the sendable is published triggered a review of the doc on LiveWindow and test mode. I was using LiveWindow.enableAllTelemetry() in testInit() to publish sendables registered with LW. This displays the data but apparently does not enable updating of the data. If you instead use a call to enableLiveWindowInTest(true) instead of enableAllTelemetry the sendable works as expected and data is updated if changed in OV. This was changed 2024. I am embrassed to say I missed the highlighted warning about this until reviewing the doc today after the question about publishing. My apologies for wasting your time but you did help me find the answer. Thanks! |
Beta Was this translation helpful? Give feedback.
Your question about how the sendable is published triggered a review of the doc on LiveWindow and test mode. I was using LiveWindow.enableAllTelemetry() in testInit() to publish sendables registered with LW. This displays the data but apparently does not enable updating of the data. If you instead use a call to enableLiveWindowInTest(true) instead of enableAllTelemetry the sendable works as expected and data is updated if changed in OV. This was changed 2024. I am embrassed to say I missed the highlighted warning about this until reviewing the doc today after the question about publishing. My apologies for wasting your time but you did help me find the answer. Thanks!