Aurora Visio Studio TOP » Program Examples » HMI Changing Trigger Mode
HMI Changing Trigger Mode
目的
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.
ヒント
The information about the settings of GigEVision devices is available here.
HMI controls are explained in this article.
Solution (AVS)
Create the application:
-
Add the GigEVision_ExecuteCommand to the Acquire section. In the Properties section set the inCommandName to TriggerSoftware.
-
Add the GigEVision_GrabImage_WithTimeout to the Acquire section. In the Properties section set the inTimeout to 100.
-
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.
-
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
-
Go back to the Main macrofilter and add a formula. Create 2 inputs:
-
Add the Exit filter. Connect its inCondition input to the formula's output created in a previous step.
-
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.
-
Inside the MainLoop macrofilter connect the macrofilter input to the GigEVision_ExecuteCommand and the GigEVision_GrabImage_WithTimeout inputs.
-
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.
- For the first filter set its inParameterName as TriggerSource and the inValue as Software.
- For the second filter set its inParameterName as TriggerMode.
-
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.
-
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
-
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.
-
Inside the CameraWorkingTask connect the macrofilter input with the 2 GigEVision_SetEnumParameter filters' inputs, the UpdateUi macrofilter input and the UpdateImage macrofilter input.
-
Go back to the Main macrofilter. Add the Delay filter to the Acquire section. Set its inTime input to 100.
-
Add the Loop filter to the Acquire section.
-
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.
-
Add the EmptyImage filter, leave the default settings.
-
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}.
-
Drag the UpdateImage macrofilter from the Project Explorer section. Connect its inImage input with the DrawStrings_SingleColor output.
-
Add the CopyObject filter, set the data type as variant GevAddress.
-
Drag the UpdateUi macrofilter from the Project Explorer section.
Create the HMI:
-
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.
-
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}.
-
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}.
-
Inside the GroupBox add the Label control available in the Controls category and set its Text as Camera Address:.
-
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.
-
Add the Label control available in the Controls category below the Camera Address: control and set its Text as Trigger Mode:.
-
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.
-
Add the ImpulseButton control available in the Controls category below the Trigger Mode: control. Set its Text as Trigger.
- Connect the inEnabled input to the formula outTriggerPossible output inside the UpdateUi macrofilter.
- Connect the outValue output to the GigEVision_ExecuteCommand inActivation input.
Macrofilter Main.
Macrofilter CameraWorkingTask.
Macrofilter MainLoop.
Macrofilter UpdateImage.
Macrofilter UpdateUi.
その他の資料
- HMI Controls - List of HMI controls.
- Working with GigE Vision Devices - This article describes the basic concept of working with GigE Vision devices.