Example Program 13: MM_S13_Vis_MoveInAdvance

Program Introduction

Description

After the Mech-Vision project is triggered to run, the robot moves in advance after the camera finishes capturing images without waiting for the Mech-Vision project to stop running. This example program is applicable to scenarios where the camera mounting method is eye in hand.

File path

You can navigate to the installation directory of Mech-Vision and Mech-Viz and find the file by using the Communication Component/Robot_Interface/ABB/sample/MM_S13_Vis_MoveInAdvance path.

For RobotWare6, the file extension is .mod. For RobotWare7, please modify the file extension from .mod to .modx.

Project

Mech-Vision project (the camera mounting method is eye in hand)

Prerequisites

  1. You have set up the standard interface communication.

  2. Automatic calibration is completed.

This example program is provided for reference only. Before using the program, please modify the program according to the actual scenario.

Program Description

This part describes the MM_S13_Vis_MoveInAdvance example program.

The only difference between the MM_S13_Vis_MoveInAdvance example program and the MM_S1_Vis_Basic example program is that MM_S13_Vis_MoveInAdvance can move the robot after the camera captures images (this code of this feature is bolded). As such, only the feature of moving the robot after the camera captures images is described in the following section. For information about the parts of MM_S13_Vis_MoveInAdvance that are consistent with those of MM_S1_Vis_Basic, see Example Program 1: MM_S1_Vis_Basic.
MODULE MM_S13_Vis_MoveInAdvance
!----------------------------------------------------------
! FUNCTION: trigger Mech-Vision project then move to
! wait position and get vision pose in EIH setup
! Mech-Mind, 2023-12-25
!----------------------------------------------------------
!define local num variables
LOCAL VAR num pose_num:=0;
LOCAL VAR num status:=0;
LOCAL VAR num label:=0;
LOCAL VAR num toolid:=0;
!define local joint&pose variables
LOCAL CONST jointtarget home:=[[0,0,0,0,90,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL CONST jointtarget snap_jps:=[[0,0,0,0,90,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget camera_capture:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget pick_wait_point:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget pick_waypoint:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget pickpoint:=[[-66.3475,-105.248,985.956],[0.000237259,-0.998599,0.0528747,0.00188901],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget drop_waypoint:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
LOCAL PERS robtarget drop:=[[302.00,0.00,558.00],[0,0,-1,0],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
!define local tooldata variables
LOCAL PERS tooldata gripper1:=[TRUE,[[0,0,0],[1,0,0,0]],[0.001,[0,0,0.001],[1,0,0,0],0,0,0]];

PROC Sample_13()
    !set the acceleration parameters
    AccSet 50, 50;
    !set the velocity parameters
    VelSet 50, 1000;
    !move to robot home position
    MoveAbsJ home\NoEOffs,v3000,fine,gripper1;
    !initialize communication parameters (initialization is required only once)
    MM_Init_Socket "127.0.0.1",50000,300;
    !move to image-capturing position
    MoveL camera_capture,v1000,fine,gripper1;
    !open socket connection
    MM_Open_Socket;
    !trigger NO.1 Mech-Vision project
    MM_Start_Vis 1,0,1,snap_jps;
    !move to wait position for picking
    MoveL pick_wait_point,v1000,z50,gripper1;
    !get vision result from NO.1 Mech-Vision project
    MM_Get_VisData 1,pose_num,status;
    !check whether vision result has been got successfully
    IF status<>1100 THEN
        !add error handling logic here according to different error codes
        !e.g.: status=1003 means no point cloud in ROI
        !e.g.: status=1002 means no vision result
        Stop;
    ENDIF
    !close socket connection
    MM_Close_Socket;
    !save first vision point data to local variables
    MM_Get_Pose 1,pickpoint,label,toolid;
    !move to intermediate waypoint of picking
    MoveJ pick_waypoint,v1000,z50,gripper1;
    !move to approach waypoint of picking
    MoveL RelTool(pickpoint,0,0,-100),v1000,fine,gripper1;
    !move to picking waypoint
    MoveL pickpoint,v300,fine,gripper1;
    !add object grasping logic here, such as "setdo DO_1, 1;"
    Stop;
    !move to departure waypoint of picking
    MoveL RelTool(pickpoint,0,0,-100),v1000,fine,gripper1;
    !move to intermediate waypoint of placing
    MoveJ drop_waypoint,v1000,z50,gripper1;
    !move to approach waypoint of placing
    MoveL RelTool(drop,0,0,-100),v1000,fine,gripper1;
    !move to placing waypoint
    MoveL drop,v300,fine,gripper1;
    !add object releasing logic here, such as "setdo DO_1, 0;"
    Stop;
    !move to departure waypoint of placing
    MoveL RelTool(drop,0,0,-100),v1000,fine,gripper1;
    !move back to robot home position
    MoveAbsJ home\NoEOffs,v3000,fine,gripper1;
ENDPROC
ENDMODULE

The workflow corresponding to the above example program code is shown in the figure below.

sample13

The table below describes the feature of moving the robot after the camera captures images. You can click the hyperlink to the command name to view its detailed description.

Feature Code and description

Move the robot after the camera captures images

!trigger NO.1 Mech-Vision project
MM_Start_Vis 1,0,1,snap_jps;
  • MM_Start_Vis: The command to trigger the Mech-Vision project to run.

  • 1: The Mech-Vision project ID.

  • 0: The Mech-Vision project is expected to return all vision points.

  • 1: Robot joint positions and flange pose must be input to the Mech-Vision project. If the camera mounting method is eye in hand, 1 is usually specified here.

  • snap_jps: Custom joint positions. The joint positions in this example program are of no practical use but must be set.

In eye in hand scenarios, to ensure that the robot can move after the camera captures images without waiting for the Mech-Vision project to finish running, you can go to Robot Communication Configuration  Next  Advanced Settings in the top toolbar of Mech-Vision and select Return “1102: Successfully triggered” after the capture. Once this option is selected, the robot will start to move after it triggers the Mech-Vision project and receives “1102: Successfully triggered”, thus reducing the cycle time.

If the option is not selected and the Mech-Vision project is started successfully, the vision system will return status code 1102 to the robot immediately. The robot cannot move at this point because the robot cannot determine whether the camera has finished capturing images. In this case, the robot has to wait for the Mech-Vision project to finish before moving.

The 1102 status code returned by the vision system indicates the logical completion of the MM_Start_Vis command. If the option is selected, the robot can start to move after the MM_Start_Vis command is executed.
configure communication
!move to wait position for picking
MoveL pick_wait_point,v1000,z50,gripper1;

The above code indicates that the robot can move to the waiting waypoint of picking after image capturing. This indicates that the Mech-Vision project can be run at the same time when the robot moves to shorten the cycle time.

Please note the difference between this example program and the MM_S1_Vis_Basic program. The MM_S1_Vis_Basic example program allows the robot to move only after the Mech-Vision project finishes running, while this example program allows the robot to move after the camera finishes capturing images.

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.