getNumber Depricated, what can I use?

NetworkTable table = NetworkTableInstance.getDefault().getTable(“limelight”);
// // Whether the limelight has any valid targets (0 or 1)
float tv = table.getEntry(“tv”);
// // Horizontal Offset From Crosshair To Target (-27 degrees to 27 degrees)
NetworkTableEntry tx = table.getEntry(“tx”);
// // Vertical Offset From Crosshair To Target (-20.5 degrees to 20.5 degrees)
NetworkTableEntry ty = table.getEntry(“ty”);
// //Target Area (0% of image to 100% of image)
NetworkTableEntry ta = table.getEntry(“ta”);
// // Skew or rotation (-90 degrees to 0 degrees)
NetworkTableEntry ts = table.getEntry(“ts”);

So far this is my code, all docs for java that I can find say use getNumber, but it is undefined and depricated, so what else can I use, I am programming a LimeLight Camera, and if I could get any examples that would be great, thanks in advance!

NetworkTableEntry.getNumber() exists, although it returns a Java Number instead of double. If you want a double use NetworkTableEntry.getDouble(). Note to both of these functions you need to provide a default value to return in case the entry doesn’t yet exist (which will happen if the code runs before the limelight connects, for example).

Well when I type table.get, this is all that it will allow me to do

image

You want to use the methods on the NetworkTableEntry’s that you got from table.getEntry(), not the table itself. E.g. double tsValue = ts.getDouble(0.0);

Ah, that seems to have worked so far, thank you!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.