Single Round of Data Acquisition: External + Encoder

This topic introduces how to trigger multiple rounds of data acquisition and retrieve the profile data with the trigger_with_external_device_and_encoder sample on Windows.

Please refer to Usage Guide for HALCON Samples to obtain the samples and check the prerequisites for using the samples.

Acquire Data

This sample uses the external + encoder method to trigger data acquisition.

Please follow these steps to acquire data:

  1. Open the sample in HDevelop: Open HDevelop, and drag the sample into HDevelop.

  2. Adjust the encoder-related parameters: Refer to the instructions in Adjust Parameters and adjust the following encoder-related parameters according to your actual needs:

  3. Step over the program (click the step over button in the toolbar repeatedly), until the Variable Inspect: MechEyeProfilerInfos window pops up.

  4. This window displays all the available laser profilers. Double-click the laser profiler that you want to connect, and copy the name after unique_name: or user_name:.

    camera name
    user_name is the custom laser profiler name. You can customize the camera name in Mech-Eye Viewer.
  5. Locate the following line, and replace LNX with the copied unique_name or user_name.

    DeviceInfo := 'LNX'
  6. Run the sample by clicking run in the toolbar or pressing the F5 key.

  7. Input the trigger signal from the external device: Make sure that the trigger signal is input to the laser profiler each time after the grab_data command is executed and before the grab_timeout period has passed.

  8. View the acquired intensity image and depth map data in the following variables:

    • reflectance: intensity image

    • depthInMM: depth map

Adjust Parameters

If the quality of the obtained data is unsatisfactory, you can adjust the corresponding parameters..

  • The laser profiler provides the parameter group feature. By selecting a different parameter group, you can quickly change the parameter configuration for the laser profiler. Laser profiler parameters must be adjusted and saved in a parameter group.

  • If you need to add or delete a parameter group, you can do so in Mech-Eye Viewer.

To adjust the parameters, follow these steps:

  1. Use the following operator to obtain the list of available parameter groups on the laser profiler.

    get_framegrabber_param (AcqHandle, 'UserSetSelector_values', ParameterGroupNames)
  2. View the list of parameter groups in the ParameterGroupNames variable in the Control Variables area.

  3. Use the following operator to select the parameter group to modify. UserSetSelector and UserSetLoad are the laser profiler parameters used to select and load a parameter group, respectively. Replace ParameterGroupName with the actual parameter group name.

    The parameter group name displayed in HDevelop corresponds to the order of parameter groups in Mech-Eye Viewer. For example, UserSet0 in HDevelop is the first parameter group in Mech-Eye Viewer. For details, refer to Select Parameter Group in HALCON.
    set_framegrabber_param (AcqHandle, 'UserSetSelector','ParameterGroupName')
    set_framegrabber_param (AcqHandle, 'UserSetLoad','ParameterGroupName')
  4. Use the following operator to obtain the value of a specific parameter. Replace ParameterName with the actual name of the laser profiler parameter. The parameter value is saved in the ParameterValues variable. You can change the variable name according to actual needs. Note that this variable does not need to be included in parentheses.

    get_framegrabber_param (AcqHandle, 'ParameterName', ParameterValues)
  5. View the parameter value in the ParameterValues variable in the Control Variables area.

  6. Use the following operator to adjust the value of the specified parameter. Replace ParameterName with the actual name of the laser profiler parameter and NewParameterValue with the new parameter value.

    set_framegrabber_param (AcqHandle, 'ParameterName', 'NewParameterValue')
  7. Use the following operator to save the parameter value modification into the parameter group. UserSetSave is the laser profiler parameter used to save the parameter group. Replace ParameterGroupName with the actual parameter group name.

    set_framegrabber_param (AcqHandle, 'UserSetSave', 'ParameterGroupName')

References

  • The parameters available in GenICam clients generally correspond with those available in Mech-Eye Viewer. For the detailed correspondence, refer to Laser Profiler Parameters Available in GenICam Client.

  • Adjusting parameters such as Correction and Mask usually requires the assistance of visualized tools for several rounds of fine tuning. Since GenICam clients does not provide visualized tools, you can adjust these parameters using the visualized tools provided by Mech-Eye Viewer. For details, refer to Adjust Laser Profiler Parameters Using Mech-Eye Viewer.

    You must disconnect from the laser profiler in HDevelop before you can connect to it in Mech-Eye Viewer. If you fail to connect the laser profiler in Mech-Eye Viewer, close HDevelop and try again.