06-14-2024 08:26 PM
I'm using an NI myRIO board programmed in LabVIEW to gather data from IR sensors and other sensors. I want to establish real-time bidirectional communication with Python using TCP/IP. How can I set up this communication to send sensor data to Python and receive control commands for motors from Python to myRIO? Are there any code examples or resources available to help me implement this solution?
Thank you in advance for your assistance!
06-15-2024 09:34 AM
If your myRIO code is developed as a LabVIEW Real-Time Project with the Host code on a PC running LabVIEW, using the myRIO as the Target, you might be able to use Network Streams to get (Host) LabVIEW to interact with the code on the myRIO and pass the data on to Python (running on the Host). I don't use Python, but I think NI has some ability to call on Python for computations, and certainly knows how to communicate with the myRIO ...
Bob Schor
06-19-2024 05:00 AM - edited 06-19-2024 05:04 AM
The myRIO is in it's basic functionality simply another CompactRIO system. Unless you want to make use of the special myRIO functions to access it's integrated I2C and other hardware interfaces, you don't even need to install the myRIO Toolkit but can work with any CompactRIO installation. The myRIO Toolkit is basically just a special version of the CompactRIO driver with additional support libraries for myRIO specific hardware interfaces and other myRIO specific tools but it is possible to access the myRIO with a standard CompactRIO installation.
And NI provides a Python interface to their NI-FPGA driver, which is at the core of the CompactRIO interface to the FPGA systems.
https://nifpga-python.readthedocs.io/en/latest/
NI-FPGA is simply the low level C API to interface to any NI CompactRIO (and I believe FlexRIO) hardware device. And the above mentioned Python module is simply a Python wrapper around this C API using the Python ctypes functionality.
With NI-FPGA you can access registers (front panel controls on the FPGA main VI), IRQs and FIFOs.