Jump to content

Factory Pattern on a VI running on RT target


Recommended Posts

Hi everyone,
I have a myRIO that i try to use to implement a factory pattern of OOP.
I have to classes that i need to load dynamically on the VI running in the RT target.
Firstly, i saved my classes in the myRIO's memory on the path /home/lvuser/natinst/bin/Host_Class in the directory Host_Class.
And i give to the VI "Get LV Class Default Value" this path but i had this error : 
Error 7 occurred at : Get LV Class Default Value.vi

Possible reasons :

LabVIEW: (Hex 0x7) File not found. The file may be in a different location or may have been deleted. Use the command prompt or file explorer to verify that the path is correct.
=========================
GPIB interface not existing.

LabVIEW tried to load the class this way:
/home/lvuser/natinst/LabVIEW Data/Host_Class/Accelerometer/Accelerometer.lvclass

But when i check this directory, my classes are there

Link to post
Share on other sites

I am a bit confused. You said you saved the classes to:

/home/lvuser/natinst/bin/Host_Class

but then you tried to load them from

/home/lvuser/natinst/LabVIEW Data/Host_Class/Accelerometer/Accelerometer.lvclass

These directories are different...

Edited by Neil Pate
Link to post
Share on other sites

I have never actually tried to use the factory pattern on a cRIO. So much trouble getting it to work properly just under Windows I have never been brave enough. Do you absolutely have to do runtime instantiation using names? Have you tried a static VI reference?

Link to post
Share on other sites

Sounds interesting. Sorry I have never tried to dynamically load classes in RT, I have enough trouble these days just getting normal code to deploy without stupid un-explainable errors in LabVIEW.

For some reason my RT VM is not cooperating and I cannot copy any files across to test. Have you tried to load a very simple class? I presume you have some kind of HAL with inheritance? Maybe the error is because it is missing some dependencies? (I know error 7 is missing file though, as you mentioned).

Have you tried loading the class with the 0x10 option?

image.png.d1da986cd7df470771f7ebe260d24424.png

Link to post
Share on other sites
5 hours ago, Neil Pate said:

For some reason my RT VM is not cooperating and I cannot copy any files across to test.

As a workaround, you can transfer files into a USB stick from your host, and then attach the stick to your VM.

Link to post
Share on other sites

I am not sure I follow you. Are you saying an absolute path on RT does not work when trying to load the class from disk?

Can you not load the class from the /C/ or similar? That seems weird!

Link to post
Share on other sites
Posted (edited)

Previously, i loaded the folder containing my all classes (for example the folder Host_Class). I had placed this folder in the path /home/lvuser/natinst/bin/. I.e I will had  /home/lvuser/natinst/bin/Host_Class

Now, i place directly my classes in the path /home/lvuser/natinst/bin/  and not via a directory like Host_Class.

Apparently, By default, when RT target runs, the reading is limited only to the path specified in the RT target properties. In my case, this path is /home/lvuser/natinst/bin/

 
 

 

Edited by Renny Sadala
Link to post
Share on other sites
18 hours ago, Renny Sadala said:

Previously, i loaded the folder containing my all classes (for example the folder Host_Class). I had placed this folder in the path /home/lvuser/natinst/bin/. I.e I will had  /home/lvuser/natinst/bin/Host_Class

Now, i place directly my classes in the path /home/lvuser/natinst/bin/  and not via a directory like Host_Class.

Apparently, By default, when RT target runs, the reading is limited only to the path specified in the RT target properties. In my case, this path is /home/lvuser/natinst/bin/

 
 

 

You might check the folder permissions for the folder you created. I have ran into issues with that before. 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.