02-28-2024 02:44 AM
Hello,
I have a Tetrix robot that I am programming using MyRIO. When I power up the card and motor driver, only the left motor remains active. However, when I upload my code, it runs smoothly and as expected. The problem arises when I exit the execution, as the left motor restarts unexpectedly.
Could you please assist me in troubleshooting and resolving this issue?
Thank you.
02-28-2024 08:31 PM
Bob Schor
03-02-2024 06:46 AM
I use labview 2021 and driver of motor I use myRIO Motor Controller Board 41136
03-02-2024 01:37 PM
Well, the Good News is I have experience with the myRIO, and I also have experience with running Stepper Motors using LabVIEW (I'm working on a Project now with a small NEMA stepper and the A4988 Controller Chip, driven quite nicely by an NI USB-6212).
I also see you are using what should be a "workable" LabVIEW configuration, namely LabVIEW 2021 + myRIO Software Toolkit 2021. [I'm currently running my myRIO with the 2019 versions, but I am planning to migrate to LabVIEW 2021, and have a myRIO "ready to go" with the updated firmware and myRIO Software Toolkit).
So it should be a relatively simple procedure to look through your Project, find the concurrent Parallel Loops (many of my Projects have at least 3-5, both in the Host (PC) and Target (myRIO) parts of the Project).
You need to look at your code on the Target (myRIO) side, looking for where you control the two motors. Ask yourself what you expect (or "want") your code to do when you push the "Stop" button on your Front Panel. In my Stepper Motor code (first paragraph, above), I have three parallel loops running -- an Event Loop, a Channel State Machine Loop, and a Stepper (Channel) State Machine Loop. The Stop button is "captured" by the Event Loop, sends an "Exit Main" and "Exit Stepper" message to the two State Machines, then stops the Event Loop (by wiring "True" to the Boolean Stop of the While Loop). The respective "Exit" States in the two Channel Message Handler loops similarly wire "True" to the Boolean Stop. When all three stop, the program exits.
You need to figure out why your code isn't stopping. Since the Target (myRIO) code doesn't have a real "Front Panel", you need to send a "Stop" message from the Host to the Target. I use Network Streams for this, as I've found Network Shared Variables unreliable.
Can you get the Host code, at least, to stop?
Bob Schor