Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   LabVIEW Dashboard Interfacing With Java Code (http://www.chiefdelphi.com/forums/showthread.php?t=125404)

Joe Ross 28-01-2014 20:45

LabVIEW Dashboard Interfacing With Java Code
 
I was recently asked the following question via PM, but I thought the answers might be helpful for other people, and so that other more experienced people could chime in.

Quote:

Have you been able to interface Java with LabVIEW so that sensor data is automatically shown. What I mean by this is something like when I call

SmartDashboard.put ("Intake Roller", intakeRollerSpeed);

in the SmartDashboard this would automatically populate with a label Intake Roller and the value would get updated accordingly. Is there someway I can implement automatic population in a custom LabVIEW Dashboard and a Java coded robot?
I have not looked very much at the 2014 LabVIEW Dashboard, but I expect it would be similar to 2013. The 2013 dashboard had a tab called Operation. Any controls you placed on that tab would be automatically bound to the SmartDashboard variable of the same name as the control. This isn't quite as easy as the Java Smartdashboard since the controls don't appear automatically, but it's very easy to drag a new control to the tab and rename. This will also transmit any changes made to the control on the front panel. It will not transmit any changes made programmatically, so you can't use this, for example, to send vision data that was processed on the dashboard to the robot.

Additionally, the Variables tab shows all Smartdashboard variables in a tree format.

Quote:

From my understanding I have to send my data to a NetworkTable with a key and value in my Java code and call upon the same key in my LabVIEW Dashboard to view the feedback.
This is the more flexible way to do it. I would recommend using the SmartDashboard class in Java and the SmartDashboard VIs in LabVIEW (NetworkTable is a little lower level). You can do additional calculations in LabVIEW either before transmittal or before display.

Last year, we used a nicely configured LabVIEW dashboard with large indicators and controls that the drivers could use. When the programmers wanted to debug something, we would bring up the java smartdashboard, because it was more convenient to send and receive arbitrary variables. You can even have both of them running at the same time.

TuxCoding 29-01-2014 02:07

Re: LabVIEW Dashboard Interfacing With Java Code
 
Yeah, we are trying to do that this year, since we switched our robot code from Labview to Java. We keep running into "Table Key not found" errors (basically not finding the values on the Dashboard and saying "Output not updated often enough"). I tried both Networktables and SmartDashboard, and was wondering how you set up the VI and .java file?

BradAMiller 29-01-2014 07:38

Re: LabVIEW Dashboard Interfacing With Java Code
 
Quote:

Originally Posted by TuxCoding (Post 1334083)
Yeah, we are trying to do that this year, since we switched our robot code from Labview to Java. We keep running into "Table Key not found" errors (basically not finding the values on the Dashboard and saying "Output not updated often enough"). I tried both Networktables and SmartDashboard, and was wondering how you set up the VI and .java file?

The "Output not updated often enough" message is from the motor safety stuff, most likely from a RobotDrive object you created in your code. The idea is that if the RobotDrive outputs aren't updated often (every 100ms by default) it assumes that the program crashed and stops the PWM output to the motors. You can either make sure to keep updating motor values in any loops you have or disable the motor safety with:
Code:

yourRobotDriveObject.setSafetyEnabled(false);
To address the "Table key not found" error, you can see what values are in NetworkTables using the OutlineViewer.jar program. Just run it on your driver station computer and it will show you all the keys and values in NetworkTables. Then you can verify that the key is being written. For the SmartDashboard supplied with C++ and Java the keys need to be in a subtable called "SmartDashboad". I'm not sure about the LabVIEW dashboard, but will find out and add it to this post a little later today.

Greg McKaskle 29-01-2014 08:32

Re: LabVIEW Dashboard Interfacing With Java Code
 
The LV dashboard defaults to binding a control or indicator named XXX to the variable named /SmartDashboard/XXX.

This should match the other dashboards. Please let me know if you find out differently.

Greg McKaskle

Joe Ross 29-01-2014 12:11

Re: LabVIEW Dashboard Interfacing With Java Code
 
Quote:

Originally Posted by BradAMiller (Post 1334111)
To address the "Table key not found" error, you can see what values are in NetworkTables using the OutlineViewer.jar program. Just run it on your driver station computer and it will show you all the keys and values in NetworkTables. Then you can verify that the key is being written. For the SmartDashboard supplied with C++ and Java the keys need to be in a subtable called "SmartDashboad". I'm not sure about the LabVIEW dashboard, but will find out and add it to this post a little later today.

You can also look at the Variables tab in the LabVIEW dashboard.

Quote:

Originally Posted by TuxCoding (Post 1334083)
Yeah, we are trying to do that this year, since we switched our robot code from Labview to Java. We keep running into "Table Key not found" errors (basically not finding the values on the Dashboard and saying "Output not updated often enough"). I tried both Networktables and SmartDashboard, and was wondering how you set up the VI and .java file?

One thing that we do is put a default value for each variable in the constructor, so we know there's always something to get.


All times are GMT -5. The time now is 02:37.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi