Go to Post Show me the mentor who has never built a bad robot and I'll show you either a new mentor, a liar, or Andy Baker. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 26-06-2015, 15:37
Jonathan L. Jonathan L. is offline
Registered User
FRC #1094
 
Join Date: Jan 2013
Location: St. Louis MO
Posts: 60
Jonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the rough
E-num text not being sent to Dashboard when Compiled

Earlier this year during build season my team was putting together a number of automodes and we needed a way of selecting a specific mode from a drop-down menu on the Dashboard program. Below is a description of what we tried to do; I will then explain the problem. I have also included some screen shots. We had some communication issues between the Dashboard and the Robot but that is not what I'm asking about in this post.


In the Robot Project make an E-num control and add each of the automode names to it and make it a Type Def. Put this E-num in the Autonomous VI and wire it to a case structure. The code for each mode can be added to each case of the case structure. We'll come back here before we're done. Next add a copy of the E-num to the Periodic Tasks VI as a Control. Then right-click on the new control and select Create -> Property Node -> Strings[]. This reads the text from all the items in the E-num control. Then send that to the Dashboard Program via a SD Write String Array. We should be able to put this code in the Begin VI but for the purpose of Debugging we'll put it in a While Loop in Periodic Tasks and add a 5000ms Wait function.

In the Dashboard Project add a Ring Control (not an E-num) to the Dashboard Main VI. As before right-click the control and create a Property Node except this time we want to write to it. Read the Smart Dashboard variable and write it's data to the Property Node. We also need to send the selected mode back to the robot and we can do this with the SD Write Number VI. Note this is not sending the data back in an E-num, it is only sending the integer value of the E-num selection.

Back in the Autonomous VI remove the wire connecting the E-num to the case structure. Read the Smart Dashboard variable that tells us which mode is selected. Since the representation of the number we are reading is "double" and we are about to use the Type Cast function to convert it we need first to explicitly convert it to an unsigned 16 bit integer, then use Type Cast to convert it to an E-num with our automode names. The output of Type Cast is wired to the case structure and we are done.

This way all we need to do to add a new mode is to edit the Type Def. and add a case to the case structure. The drop-down menu on the Dashboard will automatically update when the robot connects to the Dashboard.


When we tested this by clicking the run arrow in Robot Main, it worked. But when we compiled the robot code and deployed it to the robot permanently, the drop-down menu would not populate on the Dashboard and we would get error 1055 "Object reference is invalid" from the property node in Periodic Tasks. My guess is that the text items in the E-num are being removed from it when the code is compiled but I don't know how to correct this. Since this didn't work we replaced the property node in Periodic Tasks with a constant and removed the Type Cast from the Autonomous VI.

Any help would be appreciated. Feel free to use this idea in your code.
Attached Thumbnails
Click image for larger version

Name:	Screenshot (94).png
Views:	42
Size:	209.0 KB
ID:	19170  Click image for larger version

Name:	Screenshot (95).png
Views:	34
Size:	189.4 KB
ID:	19171  Click image for larger version

Name:	Screenshot (96).png
Views:	32
Size:	241.2 KB
ID:	19172  
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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