02-18-2020 09:17 AM
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!
02-23-2020 07:44 AM
Without your project, I'm only guessing, but here goes (and given it previously worked, I'm not sure):
02-25-2020 06:58 PM
Thanks for your response! See my answers to your questions below:
-
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!
02-25-2020 07:13 PM
Also, I'm sure you don't want to go this deep, but just in case
02-25-2020 09:19 PM
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.
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.
Adding a new destination allows you to generate a preview like the following:
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?
02-26-2020 02:10 PM
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?