Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Updating Dashboard values from robot. (http://www.chiefdelphi.com/forums/showthread.php?t=113230)

Arkamond 11-02-2013 00:30

Updating Dashboard values from robot.
 
::rtm:: Status: Unsolved

Background Information:
I am in an FRC team and am the lead programmer and an electrical designer/engineer.

Specs:
FRC NI cRIO II
Labview 2012(13) with latest update
2Go PC D12 Rugged, Driver Station
2x Thrustmaster T.Flight Stick X Joystick

Issue:
I am unsuccessfully trying to update the Driver Station Dashboard with Boolean values from Teleop.

Currently, I have a VI named "Latch Launcher" which is right next to Teleop in the same case structure under Robot Main.vi and runs everything I have in there perfectly. I have three Latch Gates that allow buttons on the driver station joystick to be togglable, and those work as well. BUT, the issue i'm having is that I cannot successfully use a "SD Write Boolean" and then a corresponding "SD Read Boolean" on the driver station project, using the same string names of course, to send signals accurately.

It does work, but after a couple times, it just randomly stops sending signals or becomes stuck, and I have absolutely no idea why it is doing that or how to fix it. I tried creating another VI and leading all of the Boolean wires to that and setting the loop wait time to 50, but the CPU is overpowered then and won't do it. At 0, that still doesn't function. The only way I've found to partially get signals to work is by just using the plain node, but then it stops as I've said before.

How would one go about fixing this or a method to accurately send signals? And are there any examples to follow?

Feel free to ask questions, i'l answer them to the best of my ability.
Thanks, hope to hear some answers soon :)

This is how i'm writing the values in Latch Launcher


This is how I'm reading the same value on the dashboard


Here is my Labview code for the robot and dashboard, I compressed it to multiple formats for cross-compatability.
Robot Project:
-Self-Extracting 7-Zip Archive
-7-zip Archive
-Zip Archive

Dashboard Project:
-Self-Extracting 7-Zip
-7-Zip Archive
-Zip Archive

bumblebee3339 11-02-2013 07:55

Re: Updating Dashboard values from robot.
 
It might be a bit wierd, but I tried to do a simillar thing with a button in the dashboard and it didnt work when I tried to write a vlaue on the teleop and read it in the dashboard. It only worked when I used ONLY 'read' in the teleop with the name of the control in the dashboard.

Maybe you should change the writing refNum to the name of the bool indicator and delete the read function. Give it a try :P

Greg McKaskle 11-02-2013 10:16

Re: Updating Dashboard values from robot.
 
I didn't download your zip, but where is your read code located? Is it in a loop that is executing?

The other way to view data from your robot is simply to name the button the same as your variable and place it in the Operations tab on the dashboard. The read will be done for you.

Greg McKaskle

Arkamond 11-02-2013 11:16

Re: Updating Dashboard values from robot.
 
Quote:

Originally Posted by Greg McKaskle (Post 1231495)
I didn't download your zip, but where is your read code located? Is it in a loop that is executing?

The other way to view data from your robot is simply to name the button the same as your variable and place it in the Operations tab on the dashboard. The read will be done for you.

Greg McKaskle

Yes, the VI named "Latch Launcher" executes the same as Teleop, as it's in the same case structure. All functions work correctly in this VI in Teleop, and is where the "read code" is located. The "SD Write" node (Which is what is used to set the values to the dashboard) will work a couple times and then randomly stop or lock, although functions on the robot are still working fine.

How would you go about naming a button differently? And our buttons have a latching function that I implimented, we have to go through the output of the latch gate in order to determine what is turned on or off.

Arkamond 11-02-2013 11:22

Re: Updating Dashboard values from robot.
 
Quote:

Originally Posted by bumblebee3339 (Post 1231438)
It might be a bit wierd, but I tried to do a simillar thing with a button in the dashboard and it didnt work when I tried to write a vlaue on the teleop and read it in the dashboard. It only worked when I used ONLY 'read' in the teleop with the name of the control in the dashboard.

Maybe you should change the writing refNum to the name of the bool indicator and delete the read function. Give it a try :P

Do you mean use an "SD Read Boolean" instead of an "SD Write Boolean" node? The only issue with that is you cannot connect the Boolean wire anywhere, as it's giving an output, not receiving and input Boolean.

Not sure exactly what you're suggesting to do, as Boolean wires can't go to String inputs :P

Alan Anderson 11-02-2013 11:41

Re: Updating Dashboard values from robot.
 
I think you just want to show something on the Dashboard representing the state of a SmartDashboard boolean variable you're writing in the robot code. If that's right, then just put a boolean indicator on the Dashboard front panel, set its label to the name of the SmartDashboard variable, and...there is no step 3.

An unwired control or indicator in the Dashboard is automatically treated as a SmartDashboard variable.

Arkamond 11-02-2013 17:17

Re: Updating Dashboard values from robot.
 
Quote:

Originally Posted by Alan Anderson (Post 1231547)
I think you just want to show something on the Dashboard representing the state of a SmartDashboard boolean variable you're writing in the robot code. If that's right, then just put a boolean indicator on the Dashboard front panel, set its label to the name of the SmartDashboard variable, and...there is no step 3.

An unwired control or indicator in the Dashboard is automatically treated as a SmartDashboard variable.

Could you provide an example via a picture or something? I'm still not sure what you mean by it's "Label". What would I have to put in the robots code and then in the Dashboard code?

Greg McKaskle 11-02-2013 22:08

Re: Updating Dashboard values from robot.
 
The default dashboard contains three initial controls with labels of Slider 1, Checkbox 1 and Checkbox 2. The label is the name of the control. You change it by double clicking the existing label and typing a new one. If it isn't shown, you right click on the control, choose Visible Items and show the label. When you drop a new control, it typically has no label, but is blank and ready for you to type into it.

Greg McKaskle

mocibot 11-02-2013 23:50

Re: Updating Dashboard values from robot.
 
My interpretation of the Dashboard VI names and Context Help leads me to believe that the Dashboard VIs are not for use in the Dashboard code, but in the robot code. This also matches with the default text of the Dashboard. So the Read xxxx(where xxxx is string, number, bool, what have you) reads the value from the Dashboard and the Write xxx (same as before) writes to the Dashboard. I haven't had a chance to see if this is the case, if anyone can confirm or deny this let please me know.

Arkamond 12-02-2013 03:01

Re: Updating Dashboard values from robot.
 
So if I wanted to send a signal from this to the dashboard,


I would just need the "launching enabled" on the dashboard like this?

Greg McKaskle 12-02-2013 06:54

Re: Updating Dashboard values from robot.
 
The images you attached seem to write the variable correctly on the robot. If all you want to do is to display the variable to the drivers, then you do not even need to place the terminal in the loop shown. The Slider 1 and others are stacked to the side of the diagram near a comment. The important think is that the front panel control is placed in the Operations tab.

Greg McKaskle

Arkamond 13-02-2013 00:43

Re: Updating Dashboard values from robot.
 
Well I tested out the code changes today, but I found out that i'm still having the same issue to some degree. After some time, the signals stop responding. Although, all signals stop responding for a short time and then only the signals in Teleop.vi for Joystick buttons/axis' show up on the dashboard, but my indicators do nothing.

It also does this the other way. If my indicators work, then the signals from Teleop.vi to the dashboard are all 0.

Although, there is one issue and that may be a cause or symptom of what is causing this issue, and that is the indicators still stick. If the robot is turned off, whatever was on the dashboard as true stays true and doesn't go away. Shouldn't this turn off?

Anyway, I have absolutely no idea why it does this, as Teleop.vi and Latch Launcher.vi are both set at 0 for wait times and are located in the same area, but it seems that the robot goes from one to the other randomly and sometimes just stops.

Any ideas anybody?

Alan Anderson 13-02-2013 10:33

Re: Updating Dashboard values from robot.
 
A wait time of 0 in a While loop has no effect. You have loops running as fast and as often as they can, which can (and often does) starve other important tasks of CPU cycles. That includes essential communication tasks which must run in order to keep the system watchdog from shutting all outputs off.

For code that reads joystick values, there's usually no reason to run loops any more quickly than every 20 milliseconds. That's how often the data is sent from the Driver Station.


But your program has a couple of structural problems that will cause things to get weird.

First, you absolutely should not have that While loop in your Teleop vi. Teleop itself gets called repeatedly, and needs to do its job and be done well before the next data packet arrives from the Driver Station. Remove the loop (and its associated wait).

Second, you really ought not to be messing with the Robot Main vi at all. There's no difference between adding a vi to its Teleop case and just putting that vi in Teleop itself.

Third, the Latch Launcher vi is a big While loop that never ends. That will stall Robot Main when it gets invoked, and everything will come to a halt. Take it out of Robot Main and put it in the Periodic Tasks vi, which is where such loops belong.

Finally, the Latch Launcher loop is also unthrottled. Since it's responding to joystick buttons, change its 0 ms wait to a 20 ms wait.

Arkamond 13-02-2013 23:40

Re: Updating Dashboard values from robot.
 
Well that fixed it.

I placed the while loop of latch launcher and all its contents into Periodic Tasks.vi aside the other pre-existing loops and after dumping the code to the robot, it worked fine for the dashboard. Both Teleop and my functions show the buttons lighting up correctly and there's no issues on the dashboard itself or the button presses, so it works as intended.

Although, now that I've fixed that and expanded upon fixing a motor issue I had, the actual functions don't seem to work anymore, which is an entirely different issue that I'l make a different thread for. I'l mark this thread as "solved" and provide the solution on my original post once I fix that, to make sure I don't have to do anything else with sending values to the dashboard.

Thank you all for helping! (Oh, and i'l definitely need help with getting this motor bug worked out (Not really complicated, i'm just missing something that is probably obvious), so if you want to, find my other thread once it's up.


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

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