Calorified Posted January 5, 2015 Report Posted January 5, 2015 I have a C# code which I have compiled as a DLL class. It basically employs a Kinect camera to track an object and then spills distance of the camera from the object to a console window. How do I retrieve the distance (given in the console window when I run the C# executable file) by calling the .NET assembly in labview. Thank you! Quote
ned Posted January 5, 2015 Report Posted January 5, 2015 Simple, slow solution: run your .NET application using System Exec, parse the output string in LabVIEW. But then you need to run the .NET application once per piece of data you want to retrieve; it can't run continuously (since LabVIEW won't get the output string until the application terminates). Better solution: instead of writing the results to the console, push them to a UDP port, and let LabVIEW receive those UDP packets. I've used this sort of approach in several places and it's worked well. For communication between application on the same machine, UDP is simple, fast, and reliable (the loopback port shouldn't lose packets). Fully integrated approach: rework the .NET code so that you can call it through the LabVIEW .NET functions, but this might involve rewriting a lot of code, especially if some part of the .NET code needs to run continuously in the background. Quote
Calorified Posted January 5, 2015 Author Report Posted January 5, 2015 Okay. I actually tried the UDP thing this morning. Got the C# code to send the data to the UDP Port I wanted (I used an IP address of 172.22.11.2 and Port 80 which are the default for myRIO) but since my ultimate aim is to pass on the data to myRIO, I could see data on my screen but I could not ascertain the veracity as I was getting a constant string of data. I simply used the udp receiver example that came with the base development of labview but changed the ip address and udp port numbers. Quote
QueueYueue Posted January 5, 2015 Report Posted January 5, 2015 I'm not sure I fully understand your setup, but if you have a .NET assembly compiled as a dll, you should be able to call that using the normal labview .NET interface on the connectivity pallet. Checkout https://decibel.ni.com/content/docs/DOC-9138 for a quick example. 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.