Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Launch Nested Actor Example

Solved!
Go to solution

Kinda funny I have to ask this... but I was looking for an example of launching a nested actor. I guess all the major examples that I have currently seen from NI use the Launch Actor method, where you get the actor's self queue by using the read caller. But that method has now been depricated and I haven't yet seen use of the root/nested launch. The root launch is easy, and much cleaner I think. 

What I'm confused about is what to wire to the top left connector of the launch nested actor- just a class constant of the actor? That wouldn't seem right, because you almost want to use the "This" keyword, to get the actual instance of the actor that is running, not some constant. So perhaps there is a method that returns "this" actor. I'm sure that the simplest snippet of code or a pic would clear this up.

Thanks,

Rik

0 Kudos
Message 1 of 5
(5,978 Views)

Launch Nested.PNG

"This" actor is the Class ref of the actor (this is in a dynamic dspatch template VI of Controller Actor Class). I'm launching a nested actor called Background. The nice thing about nested actors is that I don't have to explicitly handle the stop of Background in Controller's stop core, it will be stopped automatically.

I hope this helps.

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
Message 2 of 5
(4,519 Views)
Solution
Accepted by topic author rik_aspinall

I've been playing around with various simple examples of this. I think the attached code shows what you're looking for. The 'launch diagram' is also shown below.

Launch Nested Actors Diagram.png

Edit: Also, just to elaborate on your question: the top-left input terminal ("Caller Actor in") is the higher-level actor that is doing the launching. Then you just wire the class constant of the actor you want to launch to the "Nested Actor" terminal. See below for FlightSim App actor launching FlightSim UI actor.

FlightSim App launches FlightSim UI.jpg

Message 3 of 5
(4,519 Views)

Use File >> Create Project... and create either of the two Actor Framework projects. Those were both updated to use Launch Root Actor and Launch Nested Actor.

Message 4 of 5
(4,519 Views)

Thanks folks! I guess I had been using the 2013 version of Labview AQ, which hadn't updated them. I just hadn't been passing the reference in from the Message's Do vi into the Class's method that I was using.

0 Kudos
Message 5 of 5
(4,519 Views)