I'm having a problem where one of my actors never closes. It seems like the Actor Core never receives the user event stop signal. I figured out that Receive Message.vi is stalling out on whatever the first message sent is, but I still don't know why. I'm not having this problem on any of my other actors.
I made an empty subVI and put an instruction to send a message to run in in the Actor.Initialized event from Monitored Actor. I found that if I have the Do vi for that message set up to return the Actor before it is sent to the subVI then the program runs fine. However, if I return the Actor from the subVI, then the Actor doesn't receive the quit message when I try to shut down the application. This subVI has no block diagram, just error clusters and Actor control and indicator hooked up to the connector pane. Unfortunately, if I try doing this "fix" with a subVI that actually does something useful, the Actor still seizes up and doesn't quit. Any suggestions?
Solved! Go to Solution.
Two of your messages, Stage Polling Loop and Stage Printing Loop, have while structures and event structures.
It's been a while since I've used NI's Actor Framework, but doesn't a loop inside of a message prevent the message from ever finishing its execution? I think those VIs would just keep running, blocking the actor queue, and preventing other messages from being received.
I thought about that, but
A. I hoped you could just use a message to launch a helper loop, but I understand if you can't.
B. It still happens even if I only send a message like Home Stage, which is about as simple as it gets.
Without your driver VI's I can't see quite everything going on (including Home Stage), but in general, messages CAN start helper loops, but Do.vi has to return, so the helper loop has to be a dynamically called VI, not just a while loop within Do.vi. The Actor will not continue doing stuff until Do.vi returns.
As for polling status of something, you could either put the helper loop in your Actor Core (which would typically run the whole time your actor runs) or you could make it into a message and use Time Delay Send Message, called once, with an infinite number of repeats. I'd probably make it a helper loop in Actor Core so it's totally asynchronous, then when the main Actor Core exits you halt the Helper loop.
Your Test VI Msg doesn't have its input connected to its output, which means the Actor it returns is a null value, and it definitely won't work. If you connect those terminals across does it work?
(If Do.vi isn't returning, then whatever is in there isn't completing. It's probably Home.vi (since that's the only thing in there) but I can't actually see that VI without your drivers.)
Thanks for the help. Turns out the helper loops and the home message had similar but unconnected problems. Without the hardware connected, Home.vi stalled forever unexpectedly, and the polling loops needed to not be in messages.