Jump to content

Help defining actors in Actor Framework

Recommended Posts

Hi everybody,


this is my first post here. I am a LabVIEW engineer (CLD) and only recently started to learn LVOOP, specifically the Actor Framework shipped with LV. I have read the whitepapers, presentations and the Evaporator Cooler example, but I'm still struggling with real life programming problems. I'm having a lot of difficulties switching from task-based thinking (JKI State Machine) to LVOOP thinking in Actor Framework and I'm hoping for some good advice here.


Basically, my biggest problem is defining what should be an Actor and what not? For this purpose, let me describe my software requirements for a machine vision application in a task-based approach:

  1. Init
    1. Load settings from file
    2. Init Camera
    3. Init DAQ device
    4. Start GUI


  1. Poll for external trigger on Camera
  2. IF TRIGGER == 1
  3. Acquire image from Camera
  4. Analyse image to get result OK (1) or FAULT (0)
  5. Send result to digital output
  6. IF RESULT == 0

    [*]Update GUI


    1. Save settings to file
    2. Release Camera
    3. Release DAQ device
    4. Exit app

  • Camera can be selected at runtime (USB camera, ethernet camera, simulated camera (ie. load images from folder), etc.) - HAL for Cameras
  • Settings (for image analysis parameters) can be changed during operation and applied to image analysis without restart of application
  • Each step can be timed (acquisition, analysis, etc.) - not a high priority, but is a nice feature for client
  • Error handling
  • Timing is crucial. Only a couple hundred milliseconds are available for the whole process. The application must NOT MISS an external trigger and MUST send the result to digital output as fast as possible.
This is my current attempt of Actor organization, based on the Evaporative Cooler example:
  • Actor
    • Timed Loop Controller
      •     Get External Trigger (needs Camera handle from Camera class, which contains child classes for each camera)

      [*]Image Acquisition (needs Camera handle) [*]Image Analysis (needs analysis parameters) [*]DAQ (needs Device handle)

      • Send Result OK
      • Send Result FAULT
    • UI abstract layer
      • GUI
      • GUI for changing/updating settings

      [*]Settings (needs Camera handle, Device handle, analysis parameters, etc)


I think this design is flawed, because I am having problems that should not happen with this design pattern: sharing data between Actors (for example camera device parameters between actors get trigger, image acquisition and settings). 


How should the Actors in the Actor Framework be organized for such an application? What do you recommend? Also, should I have a Main (Controller) Actor?

Save Image to folder
Link to comment

I think what's confusing me about your setup is why everything needs to know the camera's settings.


If you have what's essentially an "External Trigger Detector," then all it needs to do is pass an "Acquire" message to the Camera. I don't think it needs to know the camera's settings to do that.


I also don't think you need a "Settings" actor. Changes from the UI should push to a Controller, which then forwards it to the relevant Actor. So if a Camera setting is changed, the UI pushes the setting up to the Controller, the Controller then pushes the setting to Camera. If an Analysis setting is changed, UI pushes it up to Controller, and Controller pushes it to the Analysis actor.


I don't think there needs to be an Actor floating out there with all the settings for everything, waiting to be pinged.


It's also possible I don't understand the intricacies of the application, but those are my kneejerk (and somewhat layman) reactions to this Actor layout.

Link to comment

Hi Mike Le, thanks for your input. I'm still struggling with the Actor Framework mindset, but I hope my efforts will be rewarded ...



The camera has a physical digital input (trigger), so the "External Trigger Detector" actor needs the Camera Handle to poll for the HW change. The Camera Handle is received after the camera is initialized (think of it like a reference to the camera).

I was thinking of creating a Camera actor with a Get Ext Trigger message and then a Trigger actor would constantly poll the Camera actor for the trigger.



How would you suggest I handle loading and saving settings from XML file? How to handle all the settings from multiple actors?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.