loading
 
Network Tables
Paul Bramsen from United States  [5 posts]
5 years
When using network tables we are able to send values to and from the robot however after the initial value is received or sent it is never updated again. Any ideas?

Initialization code used to get table:

_networkTable = NetworkTable::GetTable("SmartDashboard");

Code used to get/set periodic updates to/from table:

_networkTable->PutNumber("Number", 100);
if (_networkTable->ContainsKey("FPS"))
    printf("FPS: %f", _networkTable->GetNumber("FPS"));
Paul Bramsen from United States  [5 posts] 5 years
BTW we're using the "Set_Variable" module in RoboRealm to set FPS to SmartDashboard/FPS.
Steven Gentner from United States  [1408 posts] 5 years
Paul,

If you are not running the latest version I'd do a quick download and get those updates. There have been a couple changes to the NT module in the last couple days.

Even without your code, you should see those values change if you are using the SmartDashboard. This can be useful just to check that the values are changing from code that should work. Then if you do see that change, you can dip into your code and see if you get the same behavior.

Note, if you use /SmartDashboard/FPS as the name in the Set_Variable module it should change assuming you are getting images into RR. Instead, you may try /SmartDashboard/IMAGE_COUNT and set that to the IMAGE_COUNT variable which ensures that with each frame you will see the number change. Remember, that if the video stream is very steady, the FPS will not change ...

STeven.
Steven Gentner from United States  [1408 posts] 5 years
Just to be sure ... have a '/' at the start of the variable name.
Paul Bramsen from United States  [5 posts] 5 years
I've done all those things. I updated just yesterday. The strange thing is that data gets sent some of the time but often if I'm trying to send multiple variables one will get sent and the rest won't. I've used Wire Shark to analyze the traffic and it looks like the packets aren't ever getting generated. I'm not sure if Roborealm isn't properly registering with network tables or what but something seems to be amiss.
Paul Bramsen from United States  [5 posts] 5 years
And I have tried variables other than FPS. Most of what I've been sending have been custom variables. I know they are updating correctly because I'm using a display_variable module to show their values in Roborealm.
Steven Gentner from United States  [1408 posts] 5 years
Paul,

The way the NT module within RR works is that it will NOT send out duplicate values. So, if the value never changes it will not send out any new information.

It seems that there may be an issue with how RR is checking to see if a value is changing since you get the first value but not successive ones.

Can you update to the most recent version 2.48.20, startup SmartDashboard and run the attached robofile. You should see 4 values appear on SmartDashboard and if you edit the second module (Translate) you can make the image move which should change the BFR variable.

If you see changes on the BFR and IMAGE_COUNT variables then updates are getting sent out and we can then focus on the CRio code to see where that may be going wrong.

Thanks,
STeven.

program.robo
Steven Gentner from United States  [1408 posts] 5 years
You'll need to update the Network Tables module's IP address (last RR module) too for this to work.

STeven.
Paul Bramsen from United States  [5 posts] 5 years
Thank you very much for the quick response and bug fix. We updated RR and our code now works! There is one remaining bug: if we try to send 0 to Network Tables the value never seems to get set. This is an easy bug to work around but not ideal. I'm not sure if this is a problem with our code or RoboRealm but I think it may be RoboRealm because I am using the Display_Variables module to display all the variables that are being sent to Network Tables and the value disappears whenever it's sent to zero. Again, thank you for the speedy bug fix.
Steven Gentner from United States  [1408 posts] 5 years
Paul,

Typically if RoboRealm sees a variable at zero it essentially removes it since the absence of the variable would equate its value to zero ... just a RR specific thing.

The NT module was ignoring non-existing variables which is why it would not transmit the value. We changed that today to also transmit a 0.0 (double) when the variable does not exist .. or can be thought of as zero.

See if the latest version solves that issue too.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index