You are here: Start » Program Examples » HMI Changing Trigger Mode

HMI Changing Trigger Mode

Aim

The aim is to create a GUI that lets the user change the trigger settings of a chosen GigEVision camera. Run the sample application to see how it works.

Hints

The information about the settings of GigEVision devices is available here.
HMI controls are explained in this article.

Solution (AVS)

Create the application:

  1. Add the GigEVision_ExecuteCommand to the Acquire section. In the Properties section set the inCommandName to TriggerSoftware.

  2. Add the GigEVision_GrabImage_WithTimeout to the Acquire section. In the Properties section set the inTimeout to 100.

  3. In the Project Explorer section create a new Step macrofilter, name it UpdateImage and drag it to the Process section of the application. Drag the outFrame output from the previous filter to the new Step. Name the new input inImage.

  4. Inside the UpdateImage macrofilter add a formula. Drag the macrofilter inImage input to the formula to crate an input. Leave the default name.

    outImage = inImage

  5. Go back to the Main macrofilter and add a formula. Create 2 inputs:

    • the inAddressChanged of Bool type,
    • the inTriggerChanged of Bool type.

      outRestartCamera = inAddressChanged or inTriggerChanged

  6. Add the Exit filter. Connect its inCondition input to the formula's output created in a previous step.

  7. Mark all the filters, right click on them and choose Extract Task (loop) from the pop-out menu. Name the new Task MainLoop. The created macrofilter should be placed in the Process section. Add an input to the MainLoop macrofilter of GevAddress type. Name it inAddress.

  8. Inside the MainLoop macrofilter connect the macrofilter input to the GigEVision_ExecuteCommand and the GigEVision_GrabImage_WithTimeout inputs.

  9. Go back to the Main macrofilter. In the Acquire section add 2 GigEVision_SetEnumParameter filters. The first one sets the trigger source for Software command execution. The second one sets the trigger mode.

  10. In the Project Explorer section create a new Step macrofilter, name it UpdateUi and drag it to the Process section of the application above the MainLoop macrofilter. Create 2 inputs of the new macrofilter:

    • the inAddress of variant GevAddress type,
    • the inTriggerMode of variant String type.
  11. Inside the UpdateUi macrofilter add a formula. Drag the macrofilter inputs to the formula to create its inputs. Leave the default names.

    outTriggerPossible = inTriggerMode == "On" and inAddress <> Nil

  12. Go back to the Main macrofilter. Mark all the filters, right click on them and choose Extract Task (loop) from the pop-out menu. Name the new Task CameraWorkingTask. The created macrofilter should be placed in the Acquire section. Create the macrofilter input of variant GevAddress type. Name it inAddress.

  13. Inside the CameraWorkingTask connect the macrofilter input with the 2 GigEVision_SetEnumParameter filters' inputs, the UpdateUi macrofilter input and the UpdateImage macrofilter input.

  14. Go back to the Main macrofilter. Add the Delay filter to the Acquire section. Set its inTime input to 100.

  15. Add the Loop filter to the Acquire section.

  16. In the Project Explorer section right-click on the CameraWorkingTask macrofilter and choose Add New Error Handler from the pop-up menu. Choose IO_ERROR in a showed window and clock on OK*. Open the error handler view.

  17. Add the EmptyImage filter, leave the default settings.

  18. Add the DrawStrings_SingleColor filter. Connect its inImage input to the EmptyImage output. Inside the Properties section:

    • In the inStrings input choose Add New Item and put Communication error occurred as a value.
    • In the inLocations input choose Add New Item and put {160;120} as a value.
    • The inColor input set to {192;192;255;0}.
  19. Drag the UpdateImage macrofilter from the Project Explorer section. Connect its inImage input with the DrawStrings_SingleColor output.

  20. Add the CopyObject filter, set the data type as variant GevAddress.

  21. Drag the UpdateUi macrofilter from the Project Explorer section.

Create the HMI:

  1. Add the VideoBox control available in the VideoBox category. Connect the inImage input with the outImage output of the formula inside the UpdateImage macrofilter. It should be placed at the top of the HMI.

  2. Add the Panel control available in the Containers category. Put it at the bottom of the HMI. In the Properties set the Dock as Bottom and the Size as {1674;290}.

  3. Inside the Panel add the GroupBox control available in the Containers category. In the Properties set the Text as Control, the Dock as Fill and the Size as {1674;290}.

  4. Inside the GroupBox add the Label control available in the Controls category and set its Text as Camera Address:.

  5. Add the GigEVision Address Picker control available in the Controls category next to the Camera Address: control.

    • Connect its inAddress input to the CopyObject output from the IO_ERROR handler.
    • Connect its outAddress output to the CameraWorkingTask inAddress input inside the Main macrofilter.
    • Connect its outAddressChanged output to the formula's inAddressChanged input inside the MainLoop macrofilter.
  6. Add the Label control available in the Controls category below the Camera Address: control and set its Text as Trigger Mode:.

  7. Add the ComboBox control available in the Controls category next to the Trigger Mode: control.

    • Inside the Properties in the Data add 2 items, Off and On.
    • Mark the Selection and set it to 0.
    • Mark the Text and set it to Off.
    • Connect its outSelectionChanged output to the formula's inTriggerChanged input inside the MainLoop macrofilter.
    • Connect its outText output to the second GigEVision_SetEnumParameter inValue input and to the UpdateUI inTriggerMode input inside the CameraWorkingTask macrofilter.
  8. Add the ImpulseButton control available in the Controls category below the Trigger Mode: control. Set its Text as Trigger.

Macrofilter Main.

Macrofilter CameraWorkingTask.

Macrofilter MainLoop.

Macrofilter UpdateImage.

Macrofilter UpdateUi.

Further Readings