VisionPro
This topic introduces how to use the VisionPro sample provided by Mech-Mind to connect to the laser profiler and obtain 2D and 3D data through C# Mech-Eye API.
Sample List
The following samples are currently provided:
-
AcquireIntensityAndRangeImagesEncoder: Trigger line scans with an encoder, obtain intensity and depth data, and generate the Cognex-format intensity image (CogImage8Grey) and depth map (CogImage16Range).
-
AcquireIntensityAndRangeImagesFixedRate: Trigger line scans at a fixed rate, obtain intensity and depth data, and generate the Cognex-format intensity image (CogImage8Grey) and depth map (CogImage16Range).
Prerequisites
In order to use the VisionPro samples, the following prerequisites must be satisfied:
-
Obtain the samples.
-
Install the required software.
Obtain Sample
VisionPro samples are included in the installation path of Mech-Eye SDK or can be obtained from GitHub by cloning. The samples in the installation path are the version at the time of Mech-Eye SDK release. The version on GitHub may contain the latest changes.
-
The samples in the installation path are located in xxx/Mech-Eye SDK-2.3.1/API/samples/visionpro/profiler.
-
The samples cloned from GitHub are located in xxx/mecheye_visionpro_samples/profiler.
Install Required Software
In order to use the VisionPro samples, Mech-Eye SDK and VisionPro must be installed.
-
Mech-Eye SDK: Install the latest version or upgrade according to Mech-Eye SDK Installation Guide.
-
Cognex VisionPro: Version 9.8 SR1 has been tested.
Configure and Run Sample
The sample can be run after the necessary configurations are completed.
Copy Dynamic-Link Libraries
To call Mech-Eye API in VisionPro, the dynamic-link libraries of Mech-Eye SDK must be copied to the installation path of VisionPro first.
Follow these steps to copy the dynamic-link libraries:
-
Go to the installation path of Mech-Eye SDK and open the following folder: xxx/Mech-Eye SDK-2.3.1/API/dll.
-
Copy the following dynamic-line library files (.dll) in the above folder:
-
MechEyeApi
-
MechEyeAPiNet
-
MechEyeApiWrapper
-
-
Go to the installation path of VisionPro, open the bin folder, and paste the copied dynamic-link library files.
Configure Referenced Assembly of Script
After copying the dynamic-link libraries, you need to configure the path of the referenced assembly in the script of the sample.
Follow these steps to configure the referenced assembly:
-
Open VisionPro QuickBuild and select Open QuickBuild Application in the File menu.
-
In the pop-up window, select the VisionPro sample to be used, and click the Open button.
-
The following window will pop-up. Click the No button in the window to close it.
-
The following window may pop-up. If it pops up, click the OK button in the window to close it.
-
In the left panel of VisionPro QuickBuild, double-click Mech-Eye 3D Laser Profiler.
-
In the left panel of the popped up Job Editor window, double-click Mech-Mind Image Grabber.
-
In the toolbar of the popped up Mech-Mind Image Grabber window, click the button.
-
In the toolbar of the popped up Mech-Mind Image Grabber Script window, click the button.
-
In the popped up Add / Remove Referenced Assemblies window, scroll down to the bottom and double-click the MechEyeApiNet.dll row.
-
In the popped up Enter Assembly Name window, click the Browse...… button, navigate to the folder where the dynamic-link libraries are located in the Mech-Eye SDK installation path (xxx/Mech-Eye SDK-2.3.1/API/dll), and select the MechEyeApiNet dynamic-link library file.
-
Click the OK button in the Enter Assembly Name window to close it, and then click the OK button in the Add / Remove Referenced Assemblies window to close it.
Set Laser Profiler IP Address
Before running the sample, you need to set the IP address of the laser profiler in the script, so that the laser profiler can be successfully connected.
You can modify the IP address of the laser profiler using Mech-Eye Viewer or the IP configuration tool. |
Follow these steps to set the IP address of the laser profiler:
-
In the Mech-Mind Image Grabber Script window, locate the following line and change the IP address in it to the actual IP address of the laser profiler to be connected.
status = profiler.Connect("192.168.20.15", 10000)
-
Click the button in the toolbar to make the change take effect.
-
Close the Mech-Mind Image Grabber Script and Mech-Mind Image Grabber windows to return to the Job Editor window.
Run Samples
Follow these steps to run the sample and view the obtained intensity image and depth map:
-
In the toolbar of the Job Editor window, click the button to run the sample.
-
In the left panel, double-click the corresponding tool to view the obtained intensity image or depth map:
-
Intensity image: Double-click CogAffineTransformTool1.
-
Depth map: Double-click Cog3DVisionDataReRenderTool1.
-
-
If the obtained images do not meet your requirements, refer to the next section and adjust the laser profiler parameters to improve the quality of the data.
Adjust Laser Profiler Parameters
The laser profiler parameters can be adjusted in Mech-Eye Viewer or in the sample through C# Mech-Eye API. It is recommended to use Mech-Eye Viewer to adjust parameters, as it provides a graphical user interface where you can acquire data immediately after adjusting the parameters to see the effect.
-
Adjust parameters using Mech-Eye Viewer: Please refer to How to Use for instructions on connecting to the laser profiler, acquiring data, viewing current parameter values, and adjusting parameters in Mech-Eye Viewer.
-
Adjust parameters in the sample through C# Mech-Eye API: To adjust the laser profiler parameters in the sample, you need to add the corresponding methods of C# Mech-Eye API to the script of the sample. Please refer to the following contents and edit the script of the sample.
-
C# Mech-Eye API samples: Refer to C# for an overview of the available samples, where to obtain them, and how to use them.
-
Mech-Eye API Reference: Explanations of the methods in C++ Mech-Eye API are provided here.
-