From 956a6827ec08f70289dc61c95fe2583145d0d6eb Mon Sep 17 00:00:00 2001 From: yindongxu1 Date: Wed, 4 Sep 2024 19:26:10 +0800 Subject: [PATCH] samples: update mecheye_halcon_samples to SDK 2.4.0 --- .../connect_to_camera_and_capture_images.hdev | 4 ++ .../determine_calibration_poses.hdev | 4 ++ .../perform_hand_eye_calibration.hdev | 10 ++- area_scan_3d_camera/obtain_depth_map.hdev | 6 ++ .../obtain_point_cloud_with_normals.hdev | 6 ++ .../obtain_textured_point_cloud.hdev | 6 ++ profiler/README.md | 2 +- ...gger_with_external_device_and_encoder.hdev | 15 ++-- ...r_with_external_device_and_fixed_rate.hdev | 15 ++-- ...rnal_device_and_fixed_rate_continuous.hdev | 14 ++-- .../trigger_with_software_and_encoder.hdev | 17 ++--- .../trigger_with_software_and_fixed_rate.hdev | 68 ++++++++++++++++--- ...th_software_and_fixed_rate_continuous.hdev | 15 ++-- 13 files changed, 119 insertions(+), 63 deletions(-) diff --git a/area_scan_3d_camera/connect_to_camera_and_capture_images.hdev b/area_scan_3d_camera/connect_to_camera_and_capture_images.hdev index b70a2eb..7091be1 100644 --- a/area_scan_3d_camera/connect_to_camera_and_capture_images.hdev +++ b/area_scan_3d_camera/connect_to_camera_and_capture_images.hdev @@ -26,6 +26,10 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 8000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the maximum number of packet gaps allowed in the GigE Vision stream. * A packet gap occurs when one or more packets are missing during the data transmission. * Setting this parameter to 500 allows a maximum of 500 packet gaps in the stream. diff --git a/area_scan_3d_camera/hand_eye_calibration/determine_calibration_poses.hdev b/area_scan_3d_camera/hand_eye_calibration/determine_calibration_poses.hdev index 28af6ed..c2cb54d 100644 --- a/area_scan_3d_camera/hand_eye_calibration/determine_calibration_poses.hdev +++ b/area_scan_3d_camera/hand_eye_calibration/determine_calibration_poses.hdev @@ -37,6 +37,10 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 10000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the calibration board model. * Replace "BDB-5" with the calibration board model in use. * Possible values include BDB-5, BDB-6, BDB-7, OCB-005, OCB-010, OCB-015, OCB-020, CGB-020, CGB-035, and CGB-050. diff --git a/area_scan_3d_camera/hand_eye_calibration/perform_hand_eye_calibration.hdev b/area_scan_3d_camera/hand_eye_calibration/perform_hand_eye_calibration.hdev index 97e8b09..91152cf 100644 --- a/area_scan_3d_camera/hand_eye_calibration/perform_hand_eye_calibration.hdev +++ b/area_scan_3d_camera/hand_eye_calibration/perform_hand_eye_calibration.hdev @@ -27,13 +27,17 @@ * Obtain the firmware version of the camera. get_framegrabber_param (AcqHandle, 'DeviceFirmwareVersion', FirmwareVersion) * Stop execution if the firmware version is lower than 2.1.0. -if (FirmwareVersion < '2.1.0') +if (FirmwareVersion < '2.4.0') stop() endif * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 10000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the "DeviceScanType" parameter to "Areascan" to obtain the 2D image. set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan') * Set the camera mounting mode. @@ -122,7 +126,7 @@ timeout := 10 while (1) wait_seconds(0.5) - set_framegrabber_param (AcqHandle, 'UserSetLoad', 0) + set_framegrabber_param (AcqHandle, 'UpdateCalibStatus', 0) * Check whether the above processes have been completed. get_framegrabber_param (AcqHandle, 'CollectStatus', CollectRet) if (CollectRet == 'CollectDone' or CollectRet == 'COLLECT_DONE') @@ -165,7 +169,7 @@ timeout := 100 while (1) wait_seconds(0.5) - set_framegrabber_param (AcqHandle, 'UserSetLoad', 0) + set_framegrabber_param (AcqHandle, 'UpdateCalibStatus', 0) * Check whether the calculation has been completed. get_framegrabber_param (AcqHandle, 'CalibStatus', CalibRet) if (CalibRet == 'CalibDone' or CalibRet == 'CALIB_DONE') diff --git a/area_scan_3d_camera/obtain_depth_map.hdev b/area_scan_3d_camera/obtain_depth_map.hdev index 0c5c15c..e231279 100644 --- a/area_scan_3d_camera/obtain_depth_map.hdev +++ b/area_scan_3d_camera/obtain_depth_map.hdev @@ -28,6 +28,12 @@ if (FirmwareVersion < '2.0.3') stop() endif + +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) + * Set the "DeviceScanType" parameter to "Areascan3D" to obtain the 3D data. set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan3D') * Obtain the available options of the "ComponentSelector" parameter. diff --git a/area_scan_3d_camera/obtain_point_cloud_with_normals.hdev b/area_scan_3d_camera/obtain_point_cloud_with_normals.hdev index a2d2a1d..1dc742f 100644 --- a/area_scan_3d_camera/obtain_point_cloud_with_normals.hdev +++ b/area_scan_3d_camera/obtain_point_cloud_with_normals.hdev @@ -27,6 +27,12 @@ if (FirmwareVersion < '2.2.0') stop() endif + +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) + * Set the "DeviceScanType" parameter to "Areascan3D" to obtain the 3D data. set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan3D') * Obtain the available options of the "ComponentSelector" parameter. diff --git a/area_scan_3d_camera/obtain_textured_point_cloud.hdev b/area_scan_3d_camera/obtain_textured_point_cloud.hdev index d211326..cd0abe2 100644 --- a/area_scan_3d_camera/obtain_textured_point_cloud.hdev +++ b/area_scan_3d_camera/obtain_textured_point_cloud.hdev @@ -27,6 +27,12 @@ if (FirmwareVersion < '2.0.3') stop() endif + +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) + * Set the "DeviceScanType" parameter to "Areascan3D" to obtain the 3D data. set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan3D') * Obtain the available options of the "ComponentSelector" parameter. diff --git a/profiler/README.md b/profiler/README.md index 9e046e5..1baceb7 100644 --- a/profiler/README.md +++ b/profiler/README.md @@ -47,4 +47,4 @@ This section describes the method for connecting to a specific laser profiler. T * [trigger_with_software_and_fixed_rate_continuous](https://github.com/MechMindRobotics/mecheye_halcon_samples/tree/master/profiler/trigger_with_software_and_fixed_rate_continuous.hdev): Trigger multiple rounds of data acquisition with the signals input from software, trigger line scans at a fixed rate, and then retrieve the acquired data. * [trigger_with_external_device_and_fixed_rate_continuous](https://github.com/MechMindRobotics/mecheye_halcon_samples/tree/master/profiler/trigger_with_external_device_and_fixed_rate_continuous.hdev): - Trigger multiple rounds of data acquisition with signals input from the external device, trigger line scans at a fixed rate, and then retrieve the acquired data. \ No newline at end of file + Trigger multiple rounds of data acquisition with signals input from the external device, trigger line scans at a fixed rate, and then retrieve the acquired data. diff --git a/profiler/trigger_with_external_device_and_encoder.hdev b/profiler/trigger_with_external_device_and_encoder.hdev index 3689039..7348dec 100644 --- a/profiler/trigger_with_external_device_and_encoder.hdev +++ b/profiler/trigger_with_external_device_and_encoder.hdev @@ -34,23 +34,18 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 20000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the maximum number of packet gaps allowed in the GigE Vision stream. * A packet gap occurs when one or more packets are missing during the data transmission. * Setting this parameter to 500 allows a maximum of 500 packet gaps in the stream. set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxPacketGaps', 500) -* Set the "DeviceScanType" parameter to "Areascan" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan') + * Set the "ExposureMode" parameter to "Timed" and the "ExposureTime" parameter to 80 μs. set_framegrabber_param (AcqHandle, 'ExposureMode', 'Timed') set_framegrabber_param (AcqHandle, 'ExposureTime', 80) -* Set the "ComponentSelector" parameter to "Intensity" and the "PixelFormat" parameter to "Mono8" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'ComponentSelector', 'Intensity') -set_framegrabber_param (AcqHandle, 'PixelFormat', 'Mono8') - -* Obtain the raw image from the laser profiler. -grab_image (RawImage, AcqHandle) -* Save the raw image to the "RawImage" BMP file. -write_image( RawImage , 'bmp' , 0 , 'RawImage' ) * Set the "DeviceScanType" parameter to "Linescan3D" to obtain the profile data. * If the laser profiler has not fully completed the data acquisition, the "DeviceScanType" parameter may be locked. diff --git a/profiler/trigger_with_external_device_and_fixed_rate.hdev b/profiler/trigger_with_external_device_and_fixed_rate.hdev index 50b37fb..16c1fae 100644 --- a/profiler/trigger_with_external_device_and_fixed_rate.hdev +++ b/profiler/trigger_with_external_device_and_fixed_rate.hdev @@ -34,23 +34,18 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 20000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the maximum number of packet gaps allowed in the GigE Vision stream. * A packet gap occurs when one or more packets are missing during the data transmission. * Setting this parameter to 500 allows a maximum of 500 packet gaps in the stream. set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxPacketGaps', 500) -* Set the "DeviceScanType" parameter to "Areascan" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan') + * Set the "ExposureMode" parameter to "Timed" and the "ExposureTime" parameter to 80 μs. set_framegrabber_param (AcqHandle, 'ExposureMode', 'Timed') set_framegrabber_param (AcqHandle, 'ExposureTime', 80) -* Set the "ComponentSelector" parameter to "Intensity" and the "PixelFormat" parameter to "Mono8" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'ComponentSelector', 'Intensity') -set_framegrabber_param (AcqHandle, 'PixelFormat', 'Mono8') - -* Obtain the raw image from the laser profiler. -grab_image (RawImage, AcqHandle) -* Save the raw image to the "RawImage" BMP file. -write_image( RawImage , 'bmp' , 0 , 'RawImage' ) * Set the "DeviceScanType" parameter to "Linescan3D" to obtain the profile data. * If the laser profiler has not fully completed the data acquisition, the "DeviceScanType" parameter may be locked. diff --git a/profiler/trigger_with_external_device_and_fixed_rate_continuous.hdev b/profiler/trigger_with_external_device_and_fixed_rate_continuous.hdev index dd40342..82030e7 100644 --- a/profiler/trigger_with_external_device_and_fixed_rate_continuous.hdev +++ b/profiler/trigger_with_external_device_and_fixed_rate_continuous.hdev @@ -33,22 +33,18 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 60000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the maximum number of packet gaps allowed in the GigE Vision stream. * A packet gap occurs when one or more packets are missing during the data transmission. * Setting this parameter to 500 allows a maximum of 500 packet gaps in the stream. set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxPacketGaps', 500) -* Set the "DeviceScanType" parameter to "Areascan" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan') + * Set the "ExposureMode" parameter to "Timed" and the "ExposureTime" parameter to 80 μs. set_framegrabber_param (AcqHandle, 'ExposureMode', 'Timed') set_framegrabber_param (AcqHandle, 'ExposureTime', 80) -* Set the "ComponentSelector" parameter to "Intensity" and the "PixelFormat" parameter to "Mono8" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'ComponentSelector', 'Intensity') -set_framegrabber_param (AcqHandle, 'PixelFormat', 'Mono8') -* Obtain the raw image from the laser profiler. -grab_image (RawImage, AcqHandle) -* Save the raw image to the "RawImage" BMP file. -write_image( RawImage , 'bmp' , 0 , 'RawImage' ) * Set the "DeviceScanType" parameter to "Linescan3D" to obtain the profile data. * If the laser profiler has not fully completed the data acquisition, the "DeviceScanType" parameter may be locked. diff --git a/profiler/trigger_with_software_and_encoder.hdev b/profiler/trigger_with_software_and_encoder.hdev index c6896a4..4b3d4cc 100644 --- a/profiler/trigger_with_software_and_encoder.hdev +++ b/profiler/trigger_with_software_and_encoder.hdev @@ -32,23 +32,18 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 20000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the maximum number of packet gaps allowed in the GigE Vision stream. * A packet gap occurs when one or more packets are missing during the data transmission. * Setting this parameter to 500 allows a maximum of 500 packet gaps in the stream. set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxPacketGaps', 500) -* Set the "DeviceScanType" parameter to "Areascan" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan') + * Set the "ExposureMode" parameter to "Timed" and the "ExposureTime" parameter to 80 μs. set_framegrabber_param (AcqHandle, 'ExposureMode', 'Timed') set_framegrabber_param (AcqHandle, 'ExposureTime', 80) -* Set the "ComponentSelector" parameter to "Intensity" and the "PixelFormat" parameter to "Mono8" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'ComponentSelector', 'Intensity') -set_framegrabber_param (AcqHandle, 'PixelFormat', 'Mono8') - -* Obtain the raw image from the laser profiler. -grab_image (RawImage, AcqHandle) -* Save the raw image to the "RawImage" BMP file. -write_image( RawImage , 'bmp' , 0 , 'RawImage' ) * Set the "DeviceScanType" parameter to "Linescan3D" to obtain the profile data. * If the laser profiler has not fully completed the data acquisition, the "DeviceScanType" parameter may be locked. @@ -75,6 +70,8 @@ * Set the "DataAcquisitionTriggerSource" parameter to "Software", so that data acquisition is triggered by the software. * For Mech-Eye LNX-8080A: Comment out the following line. set_framegrabber_param (AcqHandle, 'DataAcquisitionTriggerSource', 'Software') +* Set the "AcquisitionMode" to "SingleFrame", so that the laser profiler performs a single round of data acquisition. +set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'SingleFrame') * Set the "TriggerMode" parameter to "Off". * The "TriggerMode" parameter controls if the selected trigger is active. set_framegrabber_param (AcqHandle, 'TriggerMode', 'Off') diff --git a/profiler/trigger_with_software_and_fixed_rate.hdev b/profiler/trigger_with_software_and_fixed_rate.hdev index 124d574..d62c1b6 100644 --- a/profiler/trigger_with_software_and_fixed_rate.hdev +++ b/profiler/trigger_with_software_and_fixed_rate.hdev @@ -32,23 +32,18 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 20000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the maximum number of packet gaps allowed in the GigE Vision stream. * A packet gap occurs when one or more packets are missing during the data transmission. * Setting this parameter to 500 allows a maximum of 500 packet gaps in the stream. set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxPacketGaps', 500) -* Set the "DeviceScanType" parameter to "Areascan" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan') + * Set the "ExposureMode" parameter to "Timed" and the "ExposureTime" parameter to 80 μs. set_framegrabber_param (AcqHandle, 'ExposureMode', 'Timed') set_framegrabber_param (AcqHandle, 'ExposureTime', 80) -* Set the "ComponentSelector" parameter to "Intensity" and the "PixelFormat" parameter to "Mono8" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'ComponentSelector', 'Intensity') -set_framegrabber_param (AcqHandle, 'PixelFormat', 'Mono8') - -* Obtain the raw image from the laser profiler. -grab_image (RawImage, AcqHandle) -* Save the raw image to the "RawImage" BMP file. -write_image( RawImage , 'bmp' , 0 , 'RawImage' ) * Set the "DeviceScanType" parameter to "Linescan3D" to obtain the profile data. * If the laser profiler has not fully completed the data acquisition, the "DeviceScanType" parameter may be locked. @@ -75,6 +70,8 @@ * Set the "DataAcquisitionTriggerSource" parameter to "Software", so that data acquisition is triggered by the software. * For Mech-Eye LNX-8080A: Comment out the following line. set_framegrabber_param (AcqHandle, 'DataAcquisitionTriggerSource', 'Software') +* Set the "AcquisitionMode" to "SingleFrame", so that the laser profiler performs a single round of data acquisition. +set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'SingleFrame') * Set the "TriggerMode" parameter to "Off". * The "TriggerMode" parameter controls if the selected trigger is active. set_framegrabber_param (AcqHandle, 'TriggerMode', 'Off') @@ -121,6 +118,12 @@ * Check if the number of points is zero. If not, save the point cloud to the "PointCloud" PLY file. if(NumOfPoints != 0) write_object_model_3d (ObjectModel3D, 'ply', 'PointCloud.ply', [], []) + * Uncomment this function if you would like to retrieve the point cloud in the custom reference frame. + * The custom reference frame can be adjusted using the "Custom Reference Frame" tool in Mech-Eye + * Viewer. The rigid body transformations are automatically calculated after the settings in this + * tool have been applied. The "Custom Reference Frame" tool is recommended as the GUI allows you to + * adjust the reference frame easily and conveniently. + * transformAndSavePointCloud(AcqHandle,ObjectModel3D) endif * Visualize the point cloud. @@ -142,4 +145,49 @@ + + + + + + + + +* Define a default transformation matrix. +hom_mat3d_identity( HomMat3D ) +* Obtain the Euler angles and translation vector. +set_framegrabber_param (AcqHandle, 'Scan3dCoordinateTransformSelector', 'RotationX') +get_framegrabber_param (AcqHandle, 'Scan3dTransformValue',AngleX) +set_framegrabber_param (AcqHandle, 'Scan3dCoordinateTransformSelector', 'RotationY') +get_framegrabber_param (AcqHandle, 'Scan3dTransformValue',AngleY) +set_framegrabber_param (AcqHandle, 'Scan3dCoordinateTransformSelector', 'RotationZ') +get_framegrabber_param (AcqHandle, 'Scan3dTransformValue',AngleZ) +set_framegrabber_param (AcqHandle, 'Scan3dCoordinateTransformSelector', 'TranslationX') +get_framegrabber_param (AcqHandle, 'Scan3dTransformValue', Tx) +set_framegrabber_param (AcqHandle, 'Scan3dCoordinateTransformSelector', 'TranslationY') +get_framegrabber_param (AcqHandle, 'Scan3dTransformValue', Ty) +set_framegrabber_param (AcqHandle, 'Scan3dCoordinateTransformSelector', 'TranslationZ') +get_framegrabber_param (AcqHandle, 'Scan3dTransformValue', Tz) +* Convert the Euler angles to radians. +AngleX := AngleX * (3.141592653589793 / 180) +AngleY := AngleY * (3.141592653589793 / 180) +AngleZ := AngleZ * (3.141592653589793 / 180) +* Add the rotations to the HomMat3D matrix. +hom_mat3d_rotate(HomMat3D, AngleX,'x',0, 0, 0, HomMat3D) +hom_mat3d_rotate(HomMat3D, AngleY,'y',0, 0, 0, HomMat3D) +hom_mat3d_rotate(HomMat3D, AngleZ,'z',0, 0, 0, HomMat3D) +* Add the translations to the HomMat3D matrix. +hom_mat3d_translate( HomMat3D, Tx, Ty, Tz, HomMat3D) +* Use the HomMat3D matrix to transform the 3D object model. +affine_trans_object_model_3d(ObjectModel3D,HomMat3D,TransformedPointCloud) +* Save the transformed point cloud to the "TransformedPointCloud" PLY file. +write_object_model_3d (TransformedPointCloud, 'ply', 'TransformedPointCloud.ply', [], []) + + + + + + + + diff --git a/profiler/trigger_with_software_and_fixed_rate_continuous.hdev b/profiler/trigger_with_software_and_fixed_rate_continuous.hdev index b1e7627..1f4b32b 100644 --- a/profiler/trigger_with_software_and_fixed_rate_continuous.hdev +++ b/profiler/trigger_with_software_and_fixed_rate_continuous.hdev @@ -32,23 +32,18 @@ * Set the "grab_timeout" parameter. * The "grab_timeout" parameter defines the maximum time in milliseconds that the frame grabber will wait for an image to be grabbed before timing out. set_framegrabber_param (AcqHandle, 'grab_timeout', 20000) +* Set the "[Stream]GevStreamMaxBlockDuration" parameter to 70% of the "grab_timeout" parameter. +* The "[Stream]GevStreamMaxBlockDuration" parameter defines the maximum transmission time for a data block in microseconds. +get_framegrabber_param (AcqHandle, 'grab_timeout', grabTimeout) +set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxBlockDuration', 0.7*(grabTimeout*1000)) * Set the maximum number of packet gaps allowed in the GigE Vision stream. * A packet gap occurs when one or more packets are missing during the data transmission. * Setting this parameter to 500 allows a maximum of 500 packet gaps in the stream. set_framegrabber_param (AcqHandle, '[Stream]GevStreamMaxPacketGaps', 500) -* Set the "DeviceScanType" parameter to "Areascan" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'DeviceScanType', 'Areascan') + * Set the "ExposureMode" parameter to "Timed" and the "ExposureTime" parameter to 80 μs. set_framegrabber_param (AcqHandle, 'ExposureMode', 'Timed') set_framegrabber_param (AcqHandle, 'ExposureTime', 80) -* Set the "ComponentSelector" parameter to "Intensity" and the "PixelFormat" parameter to "Mono8" to obtain the raw image. -set_framegrabber_param (AcqHandle, 'ComponentSelector', 'Intensity') -set_framegrabber_param (AcqHandle, 'PixelFormat', 'Mono8') - -* Obtain the raw image from the laser profiler. -grab_image (RawImage, AcqHandle) -* Save the raw image to the "RawImage" BMP file. -write_image( RawImage , 'bmp' , 0 , 'RawImage' ) * Set the "DeviceScanType" parameter to "Linescan3D" to obtain the profile data. * If the laser profiler has not fully completed the data acquisition, the "DeviceScanType" parameter may be locked.