Labview Custom Dashboard problem reading NT values

Short: Our value only appears for a very short duration, and is set to 0 otherwise.

We are making a custom dashboard pane using labview and the default dashboard project (just modifying the custom tab) and we were trying to get and set values to the RoboRIO using Network Tables.

We currently have a “Set Numeric Value” block in teleop that reads an encoder position from the Talon SRX, and sets it to a NT Write value block.

On our dashboard, we have a NT Read block that we read that value from and display it with an indicator on the custom tab of the dashboard.

Most of the time it reads 0, but every once and a while, there are blips where you can see the proper value. A ‘blip’ being like 1 or 2 frames on the computer.

I don’t have an image of the code yet, but I am installing labview on my personal computer to try and recreate the code.

My thought is that it reads the value, but doesn’t store it, and then uses the default ‘0’. Every time it gets a packet, it updates the value but then quickly overwrites it with the default 0. The problem I would be having is having it ‘remember’ the last value sent

We are using this tab to set PID values so we don’t have to keep recompiling. We are probably going to use this method for autonomous positions too. Is this something that is commonly done?

By default the LabVIEW Dashboard takes the controls and and links them to the robot variable by the control name. So if you name it and try to update it in the loop it’ll overwrite itself constantly (writing the same control in multiple places). So if the name of the control is not an actual variable, it’ll default to ‘0’. To link a variable it is actually much easier:

Typical dashboard extensions only need to edit the panel. Adding new indicators or controls simply involves placing them on the panel in the Operations tab and naming them the same as the SmartDashboard variable on the robot

There is a VI in the default dashboard code that:

Collects all controls and indicators in the Basic and Custom tab. If you need to bind additional controls, add their references. You can extend the enum constant or use an integer.

and works by

Terminals of controls and indicators that are bound to the smart dashboard by name. You can place the terminals anywhere you like and even read data from them. You bind controls by adding the control reference to the array on the left. The subVI will do this for the contents of a tab, and you can do it for individual items too, as shown with the LED. To create get the reference, right-click and Create>>Reference.

I don’t think I understand completely.

As of right now, my code looks like the image attached.

How would I get a specific value from the RoboRIO to that indicator?

My other situation works - where I set the PID gains using NT (also below)

I understand that my code for reading encoders isn’t right, but writing PID values seems to work.

Any advice? Thanks!

Is your code in a loop? Both the robot and the dashboard?

The code might just be running through once and displaying it only one time.

Yes, the encoder writing code is in the teleop block (not in a loop, but I believe it gets called every packet) and the encoder reading loop is in loop 1 in the dashboard.

I am going to experiment tomorrow by setting the values to global variables and sending them via periodic tasks in the 100ms loop, although I already tried by getting the motor reference and reading the encoder position in periodic tasks. I think the problem may have been accessing it while the robot isn’t enabled and the Talon is in safety mode. It was giving me errors and not turning on the motor controllers - even in teleop enabled

I don’t see an issue with what you attached. But I can explain a bit more about the value binding.

If you put a control into the Custom tab of the DB, the code will try to bind that control or indicator to a variable of the same name. This means that if you name a numeric Arm Position, you don’t actually need a read or write on the DB. Any change to the Arm Position variable will show up in the DB and any change to the value on the DB will be sent to Network Tables.

The same is true of the Arm PID.

From your symptoms, it sounds like the variable is being set in more than one place. It may be worth searching for the text of the variable name. Ctl-F and search all project VIs.

Greg McKaskle

The problem is that I was constantly overwriting it. I used a NT read block when I didn’t need to since it automatically does it for you when you name your indicator the same as the NT write block on the RoboRIO

I may have just created the same problem.

I created a custom dashboard project
I put my CONTROL variables on the Drive Tab on the dashboard
On the block diagram I took those CONTROL variables and wrote them to the DASHBOARD WRITE VI.

Should I expect to have the same issue?

If I understand correctly, then i do not need to use the DASHBOARD WRITE VI on the dashboard block diagram. They will automatically be written for me. I will just need to READ them inside my team code. Correct?


Tim, you are seeing the same problem (you are overwriting the NT variable) but you have a different solution.

Your robot will write a number to NT. The dashboard will read it.

By default the LV dashboard writes to controls of the same name on the Basic and Custom Tabs. If you are adding a variable on the Drive tab you will need to go to the top loop and add a NT Read similar (you just need a scalar that is an array) to the one for RobotDrive Motors and then wire the output of that to the control you created.