-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Description
The docs currently recommend using NT entries directly:
If data needs to be updated (for example, the output of some calculation done on the robot), call getEntry() after defining the value, then update it when needed or in a periodic function
class VisionCalculator {
private ShuffleboardTab tab = Shuffleboard.getTab("Vision");
private GenericEntry distanceEntry =
tab.add("Distance to target", 0)
.getEntry();
public void calculate() {
double distance = ...;
distanceEntry.setDouble(distance);
}
}
This should instead recommend addNumber
with a lambda function to read a cached distanceToTarget
field.
class VisionCalculator {
private ShuffleboardTab tab = Shuffleboard.getTab("Vision");
private double distanceToTarget = 0;
public VisionCalculator() {
tab.addNumber("Distance to target", () -> distanceToTarget);
}
public void calculate() {
double distanceToTarget = /* expensive calculation*/;
}
}
The NT entry API should only be used for reading data from the dashboard, such as from a slider, button, or text field
Metadata
Metadata
Assignees
Labels
No labels