LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Launch VI on cRIO

Hello, 

 

I'm trying to load a vi programmatically on a cRIO 9042, but I keep getting the "VI is not in memory" error.  (Specifically, I'm using the ROS for LabVIEW code-base distributed by Tufts University). 


I built and deployed a source distribution with all the correct properties (following instructions given here https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000PAhpSAG&l=en-US), to no avail.  The interesting thing is, it worked perfectly when I deployed onto a cRIO 9030, but now, on the 9042, it only works when I hack it by putting the desired vis on the block diagram to forcibly put them into memory.  Is it possible there is some new setting I need to check on the 9042?  

 

I did see this post https://forums.ni.com/t5/LabVIEW/How-Can-I-Programmatically-Launch-a-VI-on-host-computer-from-RT/m-p....  Maybe I need to add the cRIO's IP to the machine access list?  Will try that today...

 

A snip of the code is attached. 


Any suggestions are greatly appreciated! 

0 Kudos
Message 1 of 6
(3,620 Views)

Without your project, I'm only guessing, but here goes (and given it previously worked, I'm not sure):

 

  • Is the VI included in the "Always Included" list when you build the exe? (I'm not familiar with the ROS code from Tufts)
  • You mention a source distribution rather than an exe - is there an exe running and you're using the source distribution for plugin-like functionality, or are you running some VI interactively after deploying the source distribution?
  • What is the code inside the "Start" node doing? An error about a VI not being in memory suggests loading by name - you might have better luck loading by path, if you know it.
  • Since you changed target, I'm guessing perhaps you changed the lvproj file. Is it possible you don't have the same settings (e.g. inclusion, remove unused VIs from library, etc) in the build specification?

GCentral
0 Kudos
Message 2 of 6
(3,555 Views)

Thanks for your response!  See my answers to your questions below:

  • Yes, it's in the 'always included'
  • right, i'm running a .rtexe on the target and according to the documentation for the code, a deployed source distribution is required to run on a rt target, presumably so it can access the ROS VIs dynamically. This software is saved under user.lib on my computer.  
  • yes, the vi is loaded by name (rather than file path).  I did try the file path once but it gave me an error - had an issue with, I think "loading a vi as a server."   Since this code worked on the other target i'm reluctant to change it too much without fully understanding why it's not working...
  • The two targets are in the same project but with different build specs, correct.   I think I double checked that but lemme triple check tomorrow. 

I did notice once difference between the two cRIOs:

When looking at the files on the 'working' cRIO, the files under home/lvuser/natinst/bin are a whole bunch of "data01","data02", "data03" etc.  Under the same folder on the NOT working cRIO, i just have the user.lib file path to the ROS code exactly as it is on my computer...    I realize this is confusing.  

 

Basically, what I would like to verify is

- What is a source distribution supposed to look like on the cRIO after deployment?  Is it literally just a copied and pasted file structure? 

- What are those "data" file folders? Are they relevant?  (I don't have access to this target at the moment to remind myself what's in them but I can take another look tomorrow)

 

Thanks again!

 

0 Kudos
Message 3 of 6
(3,536 Views)

Also, I'm sure you don't want to go this deep, but just in case 

 

https://github.com/tuftsBaxter/ROS-for-LabVIEW-Software

Message 4 of 6
(3,533 Views)

Just to completely clarify (sorry for beating a dead horse/dog/choose appropriate phrase here), in the Build Spec's "Source Files" page, you see "ROSNode.vi" in the highlighted box?:

Images below are from the ROSRIOv2.lvproj's build specification, which is for a RT exe, not a source distribution.

 

alwaysInclude.png

 

I downloaded the code from the Github link you provided and was able to get a slightly better idea, although it appears to be a fairly large project, so I haven't dug into it in great depth (as you surmised).

 

I found the "StartSeparateServer.vi", which I think is the one from your image (based on the icon). Inside this VI, it first tries to load by name, then if that fails it attempts to use a path.

The path it looks under is (on RT-Linux) /home/lvuser/natinst/bin/user.lib/ROS for LabVIEW Software/ROS/Code/NewROS/<local name>, where <local name> is the value you pass in (so ROSNode.vi).

 

 


@michellet wrote:

I did notice once difference between the two cRIOs:

When looking at the files on the 'working' cRIO, the files under home/lvuser/natinst/bin are a whole bunch of "data01","data02", "data03" etc.  Under the same folder on the NOT working cRIO, i just have the user.lib file path to the ROS code exactly as it is on my computer...    I realize this is confusing.  

 


I tried to search for more information about these files on RT, but all I found was your new thread 😉 Maybe someone will have some idea there.

When I selected the Preview option for the ROSRIO example project (pictured above) I found that only a startup.rtexe (and .aliases) file would be created (plus a bunch of error codes that aren't really relevant at the moment).

If I go to the Source File Settings tab, I can choose to include the Dependencies (as you see in the image above, no VIs are set to always include in this distribution 😕 )  via the "Set Destination for all contained items" option.

method.png

 

Adding a new destination allows you to generate a preview like the following:

preview.png

 

Maybe it's worth checking that the layout on your new target matches this. Although since you said that it was like this on the not working target, and not like this on the working target, I am as you expected confused...

 

Source distributions in general are I think just copy-pasted file structures. I don't know if this changes much/at all on RT.

 

A possible troubleshooting step would be to modify the StartSeparateServer.vi to output the file path that it attempts to use (via a log file, or network message of some kind) when loading the VI if it fails to find it. Then you could check if it exists on your target at the location intended.

 

I also checked the behaviour of the source distribution option (rather than RT application) and found that I could get the layout expected (provided I ticked "Preserve Directory Hierarchy" on "Destination Directory" under the Destinations tab) but I couldn't manage to get data0x files...

The data directory is the default "Support" destination - perhaps that is becoming involved?

 


GCentral
0 Kudos
Message 5 of 6
(3,526 Views)

Wow thanks for all this!  Good catch on the error case in StartSeparateServer.vi, I definitely missed that.  So I probed that error, and verified that my ROSNode.vi is in the correct location on the target.  This is the error that occurs when it tries to launch the VI via file path: 

 

Error 1059 occurred at Open VI Reference in StartSeparateServer.vi->CheckNodeName.vi->ROS_Topic_Init.vi:1750001->Subscribe to odom.vi

Possible reason(s):

LabVIEW: (Hex 0x423) Unexpected file type.

VI Path: /home/lvuser/natinst/bin/user.lib/ROS for LabVIEW Software/ROS/Code/NewROS/ROSNode.vi

 

So, the file is on the target in the correct location, but for some reason it thinks it's the wrong file type (even though it's a vi with a .vi extension).  Is there anything I could have accidentally changed in, say, VI properties that would change the file type? What file type does the Open VI Reference expect? 

 

0 Kudos
Message 6 of 6
(3,514 Views)