11-14-2021 05:13 PM
Hi, I need your help next time. I'm making ball balancing platform. So, I have a program running on PC, where camera observes the ball, finds his position and sends it via TCP to a myRIO, which read the messages and controls the engine using PID regulator. The problem is, that to read the message there is needed timeout in reading block, and it makes my system not stable. I need to run the program with regulator and not wait for coordinates. I need something like an interrupt but I've no idea how to do it on myRIO.
On the photo below I show the part of program receiving the message. First block check if received coordinate "x" or "y" and second get the value.
11-15-2021 04:12 AM
Build a separate while loop in which you try a read tcpip.
If timeout occurs just remove the error and try again
In case of a real message send it via a queue to your program to handle the message.
Don't forget to close the while when the proram needs to finish.
So you need a few commands to your while, maybe do this in a functional global.
You can find info on functional globals in lava.org
11-16-2021 04:40 PM
Sorry, but I don't understand how it can help me. Building a separate loop you mean to do something like on the photo below and communicate these loops using interrupts? It's possible t have two loopd? The program shows error that the loop is not connected.
To precise I need to change PWM of engines in time of waiting for message with timeot, because just one second of delay make my system not stable.
I put also my VIs in attachment.
11-18-2021 05:27 AM
11-21-2021 08:09 AM - edited 11-21-2021 08:11 AM
Hi
Just to show you I did not forget you.
I have a first implementation ready for testing by you.
In fact a functional global, it is a vi that keeps information in its shift registers and should be called just like in my test example.
A few type definitions of enums accompany this functional global and the test vi.
No error handling yet. In case of a TCP timeout you have to decide what to do and fill that in in the functional global.
I can help you if you secify what to do in that case. close and reopen is a possibility.
11-25-2021 03:00 PM
Thaks. I've managed to communicate without delay on myRio when I start the transmission on microcontroller. The consequence is that on the PC I've timeout but that's not big problem so now I'm able to create stable system.
11-25-2021 03:28 PM