Camtran returns no value from Networktables

For whatever reason, every time I try to get the positions from the “camtram” variable from the limelight networktables into the console, it doesn’t return anything.

image

“camtran” is the only thing that doesn’t return anything into the driver station console; however, when I check in Shuffleboard, networktables there displays the correct data, so I’m not sure what’s going on here. It’s my team’s first year using limelight and my first year programming for the team.

We have not used this feature, but general troubleshooting, can you find it in shuffleboard?

Not enough information. Show us your code?

Sure thing. Sorry if this formats weirdly or if I sent too little/too much code- still new to posting on ChiefDelphi.

from networktables import NetworkTables
class Limelight:
    def __init__(self):
    self.table = NetworkTables.getTable("limelight")

def get_3d_position(self):
    '''
    Get 3D position (x, y, z) and rotation (pitch, yaw, roll)
    '''

    position = self.table.getNumber("camtran", 0.0)
    print(position)  # Printing so I know if I actually am getting the camtran info.

I’m getting 0.0 whenever I print(position), which means that there’s no value for camtran. However, when I check Shuffleboard, there are values for camtran.

Yup, it’s in shuffleboard. Just can’t seem to access it in my code (posted in another comment)

Two thoughts:

  • One, if you run the program and it immediately exits, that won’t work. NetworkTables needs time to actually connect.
  • Second, it sounds like your client isn’t connected to NetworkTables. Have you looked at our troubleshooting page? It has some tips for checking that.

I’m running that particular piece of code during robot.py TeleOp, so it continually prints

I’ll check tomorrow to see if we aren’t connected to NetworkTables, though getting any other value works just fine. If I try to get any other value, it returns it correctly. If I run

def get_tx(self):
    tx = self.table.getNumber("camtran", 0.0)
    print(tx)

it’ll print 1.0, which this value is also in shuffleboard.

Oh, I see it. It’s an array. Use getNumberArray instead of getNumber.

Oh wow, I’ll change the code as soon as I can. Thank you so much!

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