RoboRealm NetworkTables

Hey All, quick question (maybe) here, we are having a significant amount of trouble using RoboRealm to send variables back and forth over a network to the smart dashboard. We have read many documents and tutorials and everything just seems to sparse in information to help. Can you only use the network tables if you are programming in Java? and secondly, how can I pull variables from the network tables. the code that i have written so far resembles:

distance = table->NetworkTable::GetNumber("/SmartDashboard/Distance");
SmartDashboard:: PutNumber(“RoboRealm Value”, distance);

we believe everything is declared correctly and we are using the
"#include “NetWorkTables/NetworkTable.h”
the problem that I believe, is that the “distance = table->…” line breaks the loop. If anyone has an idea on how to fix this, it would be greatly appreciated.

If RoboRealm is sending values to the Network Tables, and if those values are already displaying on the SmartDashboard, then the only code you need is:

double distance = SmartDashboard::GetNumber("Distance");

This is assuming RoboRealm’s variable is named “Distance”.

Thanks for the info, in the time that I posted this, we actually got a variable from RoboRealm to the SmartDashboard, the problem is, the variable is static and does not update if the camera is moved closer or further away. Basically what we are looking for is a command to force the SmartDashboard to update if there is such a thing.

Then RoboRealm isn’t doing its job and sending data to the Network Tables. Can you post a screenshot of your RoboRealm setup?

Here are pictures from RoboRealm, our WindRiver code, and an image from the SmartDashboard.



smartdashboard 1.png

windriver 2.png




smartdashboard 1.png

windriver 2.png

I feel compelled to clarify something, “FeretLevel” is just an inside joke in our team. We only called the variable that to make clear the difference between the distance value passed from RoboRealm and the value we were using within the code.

Everything seems correct. What’s the problem? Do you know if the robot is successfully getting the number?

I would try putting “feretLevel” on the dashboard, something like this:

SmartDashboard::PutNumber("WeaselLevel",feretLevel);

That way, you’ll see if the robot is getting the original Distance value and passing it back.

That was actually the reason we created the feretlevel variable. We pulled “Distance” from RoboRealm and were able to get a value for it on the dashboard. We wanted to see if we could use that value within the code, so we stored SmartDashboard::GetNumber("Distance) to feretlevel and then displayed feretlevel on the SmartDashboard. We got both of them to display the same value when we tried it, but they were still static.

We are having the same problem. We have hot target detection working great in RoboRealm but the value we are sending through network tables is not changing. We can manually alter the value of the variable through the TableViewer and the robot will react accordingly. RoboRealm will not update the value though.

Our setup is similar.
We have a python script that populate a RR var. And then a NetworkTables block that sends the var the python script populated to the robot. We are printing “Hot…” and “Not Hot…” in the python script that is updating appropriately but the value doesn’t appear to change in network tables.

Kyle

I wanted to post our solution to this problem in hopes that it can help someone else.

For reasons unknown to us using the SmartDashboard table exhibited the ‘stale’ or ‘static’ value affect referenced above.

The Solution:

We are sending one number (double) called HOTTARGET.
0 is Not Hot
1 is Hot

In RoboReam we changed the NetworkTable from SmartDashboard to RoboRealm.

Here is the C++ side of things.

class Camera2481 : public Subsystem {
private:

NetworkTable* mTable;

Camera2481() {
[INDENT]mTable = NetworkTables::GetTable("RoboRealm");
}

bool IsHotTarget() {
int ht = mTable->GetNumber("HOTTARGET", 2);
SmartDashboard::PutNumber("HOTTARGET", ht);
return ht == 1;
}
[/INDENT]
};

In the rush of the final week of building, we sort of put off vision tracking to finish the robot. I was not ignoring your comments but my team and I greatly appreciate your response. We will try out a modification of your sample code built for our application and i will get back to you as soon as possible. Thanks again.