Initialize the parameters |
-
"MM Interface".FromCamera."Status code: A vision system status code.
-
P_TRIG: Detect the signal rising edge for the logical operation result ("MM Interface".FromCamera."Status Code" equals 0).
-
MOVE: Set "Camera_Pose_Ready" to 2.
-
"Camera_Pose_Ready": Indicate whether the PLC obtained the planned path.
-
0: The PLC did not obtain the planned path when the camera was about to capture images or had already captured images, or when Mech-Vision was calculating the planed path.
-
1: The camera captured images, and the PLC obtained the planned path.
-
2: The camera was ready to start capturing images for the first time, and the PLC did not obtain the planned path.
As such, Network 1 indicates that only when "MM Interface".FromCamera."Status Code" equals 0 and P_TRIG detects a rising edge, "Camera_Pose_Ready" is initialized to 2.
|
Reset vision system status code exception flags |
-
"Camera_User".Status_Code_Error[0]: A vision system status code exception flag. True indicates that the Mech-Vision project was not successfully run, i.e., an exception occurred in the vision system.
-
"Camera_User".Status_Code_Error[1]: A vision system status code exception flag. True indicates that the Mech-Vision project failed to output the planned path, i.e., an exception occurred in the vision system.
-
"External_Reset_Camera_Error": An external reset signal. When an exception occurs in the vision system and the signal changes from False to True, the succeeding "Camera_User".Status_Code_Error[0] and "Camera_User".Status_Code_Error[1] are reset.
As such, Network 2 indicates that when "External_Reset_Camera_Error" is conducting, "Camera_User".Status_Code_Error[0] and "Camera_User".Status_Code_Error[1] are reset.
|
Set interface parameters for the Mech-Vision project |
-
"User_Vision_Project_Num": The Mech-Vision project ID.
-
"User_Robot_Pose_Type": Specify the pose type of the real robot to input to the Mech-Vision project. This value of this parameter should be set as the value of Robot_Pose_Type of the MM_Start_Vis function. In this example, the parameter value is 0. You can modify the value as needed.
-
"Camera_User".Robot_Pose[0,0]\~[0,5]: Six pieces of joint position data of the robot. This value of this parameter should be set as the value of Robot_Pose[0,0]~[0,5] of the MM_Start_Vis function. In this example, the parameter value is 0.0. You can modify the value as needed and add the robot flange pose data, i.e., the value of the Robot_Pose[1,0]~[1,5] parameter in the MM_Start_Vis function.
As such, in Network 3, Mech-Vision project ID is set to 1 and "User_Robot_Pose_Type" is set to 0. If the Mech-Vision project ID is set to 1 and "User_Robot_Pose_Type" is set to 0, "Camera_User".Robot_Pose[0,0]~[0,5] are set to 0.0 sequentially.
|
Trigger external image capturing |
-
"External_Photo_Signal": The external signal to trigger image capturing when a rising edge occurs.
-
"MM Interface"FromCamera."Status Code": A vision system status code. 1102 indicates that the PLC successfully triggered the Mech-Vision project to run. 1103 indicates that the PLC successfully obtained the planned path.
-
"Camera_User".Start_Vis: The flag that triggers the Mech-Vision project to run when the rising edge occurs.
-
"Camera_User".Get_VisData: The flag that triggers the retrieval of Mech-Vision planned path when the rising edge occurs.
As such, Network 4 indicates that the external signal to trigger image capturing when a rising edge occurs is retrieved, and then the following three image capturing operations are performed.
-
An image is captured for the first time. "MM Interface"FromCamera."Status Code" is set to 0, and "Camera_Pose_Ready" is set to 2.
-
An image is captured normally at the next time. "MM Interface"FromCamera."Status Code" equals 1103.
-
An error is reported when an image is captured at the next time. "MM Interface".FromCamera."FromCamera.STATUS_CODE does not equal 1103, and both "Camera_User".Status_Code_Error[0] and "Camera_User".Status_Code_Error[1] are set to False.
Finally, "Camera_User".Step_Num is set to 5, "Camera_User".Start_Vis and "Camera_User".Get_VisData are reset, and "Camera_Pose_Ready" is set to 0.
|
Trigger the Mech-Vision project to run and determine whether the project is triggered successfully for different processing |
|
For more information about input and output parameters in MM_Start_Vis, see MM_Start_Vis.
|
Network 5 indicates that if "Camera_User".Step_Num is set to 5, the following operations are performed.
-
MM_Start_Vis is enabled. In this case, Req_Pose_Num is set to 0, which means all waypoints are obtained. The maximum number of waypoints is 20.
-
When "MM Interface".FromCamera."Trigger Acknowledge" is set to False and "Camera_User".Status_Code_Error[0] is set to False, "Camera_User".Start_Vis is set and the PLC triggers the Mech-Vision project to run.
-
If the value of "MM Interface".FromCamera."Status Code" is greater than or equal to 1001 and less than or equal to 1099, an exception occurred in the vision system. In this case, after the rising edge for the logic output is obtained by using the P_TRIG function, "Camera_User".Status_Code_Error[0] is set and "Camera_User".Start_Vis is reset. For information about the cause of a specific status code, see Standard Interface status codes and error codes.
-
If the value of "MM Interface"FromCamera."Status Code" is 1102, the vision system has successfully executed the function sent by the PLC. In this case, the P_TRIG function is called to retrieve the rising edge for the logical output, a value of 10 is assigned to "Camera_User".Step_Num, and "Camera_User".Start_Vis and "Camera_User".Status_Code_Error[0] are reset.
|
Obtain the planned path of the Mech-Vision project and determine whether the planned path is obtained successfully for different processing |
Network 6 indicates that if "Camera_User".Step_Num is set to 10, the following operations are performed.
-
MM_Get_Planned_VisData is enabled.
-
When "MM Interface".FromCamera."Trigger Acknowledge" is set to False and "Camera_User".Status_Code_Error[1] is set to False, "Camera_User".Get_VisData is set and the PLC starts to obtain planned path output by the Mech-Vision project.When "
-
Trigger Acknowledge" is set to False and "Camera_User".Status_Code_Error[1] is set to False, "Camera_User".Get_VisData is set and the PLC starts to obtain planned path output by the Mech-Vision project.If the value of "MM Interface"FromCamera."Status Code" is greater than or equal to 1001 and less than or equal to 1099, an exception occurred in the vision system. In this case, after the rising edge for the logic output is obtained by using the P_TRIG function, "Camera_User".Status_Code_Error[1] is set and "Camera_User".Get_VisData is reset. For information about the cause of a specific status code, see Standard Interface status codes and error codes.
-
If the value of "MM Interface".FromCamera."Status Code" is 1103, the vision system has successfully executed the function sent by the PLC. In this case, "Camera_User".Get_VisData and "Camera_User".Status_Code_Error[1] are reset. The P_TRIG function is called to retrieve the rising edge for the logical output ("MM Interface"FromCamera."Status Code" equals 1103), a value of 0 is assigned to "Camera_User".Step_Num, and a value of 1 is assigned to "Camera_Pose_Ready". This indicates that the PLC has obtained the planned path and can forward the planned path to the robot.
|