ABB Example Program

You are currently viewing the documentation for version 1.7.5. To access documentation for other versions, click the "Switch Version" button located in the upper-right corner of the page.

■ To use the latest version, visit the Mech-Mind Download Center to download it.

■ If you're unsure about the version of the product you are using, please contact Mech-Mind Technical Support for assistance.

This topic introduces the example programs that perform an actual pick-and-place task.

Prerequisites

  1. You have set up the Standard Interface communication with the robot.

  2. You have completed the hand-eye calibration with the calibration program.

  3. Mech-Vision and Mech-Viz projects are created and set to autoload.

  4. The TCP (Tool Center Point) has been correctly specified.

  5. The robot velocity is reduced to avoid collision and other safety hazards during testing.

Example Programs

The example programs are stored in Mech-Center/Robot_Interface/ABB/sample in the installation directory of Mech-Mind Software Suite.

Obtain Vision Result from Mech-Vision

PROC Vision_Sample_1()
    !**********************************************************
    ! FUNCTION:Eye to Hand simple pick and place with vis
    ! 2022-5-1
    !**********************************************************
    AccSet 100, 100;
    VelSet 100, 5000;
    MoveAbsJ Home\NoEOffs,v3000,fine,Gripp1TCP;!move robot home position
    MoveL camera_capture,v500,fine,Gripp1TCP;
    PoseNum:=0;
    !Set ip address of IPC
    MM_Init_Socket "127.0.0.1",50000,60;
    WaitTime 0.1;
    !Set vision recipe
    MM_Switch_Model 1,1;
    !Run vision project
    MM_Start_Vis 1,1,2,snap_jps;
    WaitTime 1;
    MM_Get_VisData 1,LastData,PoseNum,Status;
    IF Status<>1100 THEN
        Stop;
    ENDIF
    MM_Get_Pose 1,pickpoint,label,speed1;
    MoveL RelTool(pickpoint,0,0,-100),v1000,fine,Gripp1TCP;
    MoveL pickpoint,v300,fine,Gripp1TCP;
    Stop;
    !Add object grasping logic here.
    MoveL Offs(pickpoint,0,0,100), v1000, fine, Gripp1TCP;
    MoveL waypoint1,v1000,z50,Gripp1TCP;
    MoveL RelTool(drop,0,0,-100),v1000,fine,Gripp1TCP;
    MoveL drop,v300,fine,Gripp1TCP;
    Stop;
    !Add object releasing logic here.
    MoveL Offs(drop,0,0,100), v1000, fine, Gripp1TCP;
    MoveAbsJ Home\NoEOffs,v3000,fine,Gripp1TCP;
    RETURN ;
ENDPROC

Program Logic

  1. Move the robot to HOME position.

  2. Move the robot to the image-capturing pose.

  3. Initialize communication with MM_Init_Socket.

  4. If parameter recipes are used in the Mech-Vision project, the recipe to be used is set with MM_Switch_Model.

  5. Run the Mech-Vision project with MM_Start_Vis.

  6. Wait for 1 second. Under Eye-In-Hand, this WaitTime instruction is required to make sure the robot stays still until image acquisition is completed. Under Eye-To-Hand, this WaitTime instruction can be replaced with MoveL or MoveJ.

  7. Obtain the vision result from Mech-Vision.

  8. Check if the returned status code indicates any error. If an error code is returned, the program is stopped.

  9. Move the robot to the picking waypoint and perform picking.

  10. Move the robot to an intermediate point between the picking waypoint and placing waypoint.

  11. Move the robot to the set placing waypoint and perform placing.

Customization Required

  • Define the TCP (Tool Center Point)

    The TOOL is defined as Gripp1TCP. Change the value of Gripp1TCP to the actual TCP values.

  • Define HOME Position

    Set the Home position in Home.

  • Teach the Image-Capturing Pose

    Record the image-capturing pose in camera_capture.

  • Teach the Intermediate Point(s)

    Intermediate points are between the picking pose and placing pose and are used to ensure that the robot doesn’t collide with the surrounding when moving between the picking and placing poses. You can add one or more intermediate points to waypoint of MoveL waypoint1.

  • Teach the Placing Pose

    Record the placing pose in drop.

  • Z-offset distances relative to the tool frame from the picking/placing pose are used to ensure collision doesn’t occur when the robot is approaching or departing the picking/placing pose.

    • Approach waypoint of picking

      MoveL RelTool(pickpoint,0,0,-100): the Z-offset when approaching the picking pose is set to 100 mm. The robot will move to 100 mm above the picking pose.

    • Departure waypoint of picking

      MoveL Offs(pickpoint,0,0,100): the Z-offset when departing the picking pose is set to 100 mm. The robot will move to 100 mm above the picking pose.

    • Approach waypoint of placing

      MoveL RelTool(drop,0,0,-100): the Z-offset when approaching the placing pose is set to 100 mm. The robot will move to 100 mm above the placing pose.

    • Departure waypoint of placing

      MoveL Offs(drop,0,0,100): the Z-offset when departing the placing pose is set to 100 mm. The robot will move to 100 mm above the placing pose.

  • Add the Object Picking and Releasing Logics for the Tool

    When the robot moves to the picking waypoint and the placing waypoint, you need to add the tool control logics for picking and releasing the object respectively.

Obtain Planned Path from Mech-Viz

PROC vision_sample_2()
    !**********************************************************
    ! FUNCTION:Eye to Hand simple pick and place with viz
    ! 2022-5-1
    !**********************************************************
    AccSet 100, 100;
    VelSet 100, 5000;
    MoveAbsJ Home\NoEOffs,v3000,fine,Gripp1TCP;!move robot home position
    MoveL camera_capture,v500,fine,Gripp1TCP;
    PoseNum:=0;
    !Set ip address of IPC
    MM_Init_Socket "127.0.0.1",50000,60;
    WaitTime 0.1;
    !Set vision recipe
    MM_Switch_Model 1,1;
    !Run Viz project
    MM_Start_Viz 1,snap_jps;
    WaitTime 0.1;
    !set branch exitport
    MM_Set_Branch 1,1;
    !get planned path
    MM_Get_VizData 2, LastData, PoseNum, VisPosNum, MM_Status;
    IF MM_Status <> 2100 THEN
        Stop;
    ENDIF
    FOR i FROM 1 TO PoseNum DO
        count:=i;
        MM_Get_Pose count,P{count},label1{count},speed{count};
    ENDFOR
    !follow the planned path to pick
    FOR j FROM 1 TO PoseNum DO
        count:=j;
        MoveL p{count},v1000,fine,Gripp1TCP;
        IF count=VisPosNum THEN
            Stop;
            !add object grasping logic here
        ENDIF
    ENDFOR
    !go to drop location
    MoveL RelTool(drop,0,0,-100),v1000,z50,Gripp1TCP;
    MoveL drop,v500,fine,Gripp1TCP;!drop point
    stop;
    !add object releasing logic here
    MoveL Offs(drop,0,0,100), v1000, fine, Gripp1TCP;
    MoveAbsJ Home\NoEOffs,v3000,fine,Gripp1TCP;
    RETURN ;
ENDPROC

Program Logic

In this example program, Mech-Viz leads the robot to pick and place objects under the guidance of vision result.

  1. Move the robot to HOME position.

  2. Move the robot to the image-capturing pose.

  3. Initialize communication with MM_Init_Socket.

  4. If parameter recipes are used in the Mech-Vision project, the recipe to be used is set with MM_Switch_Model.

  5. Run the Mech-Viz project with MM_Start_Viz.

  6. Obtain the planned path from Mech-Viz.

  7. Check if the returned status code indicates any error. If an error code is returned, the program is stopped.

  8. Store obtained waypoint poses in the planned path to P{} with a FOR loop.

  9. Move the robot along the planned path with a FOR loop and perform picking.

  10. Move the robot to an intermediate point between the placing waypoint and placing waypoint.

  11. Move the robot to the set placing waypoint and perform placing.

Customization Required

  • Define the TCP (Tool Center Point)

    The TOOL is defined as Gripp1TCP. Change the value of Gripp1TCP to the actual TCP values.

  • Define HOME Position

    Set the Home position in Home.

  • Teach the Image-Capturing Pose

    Record the image-capturing pose in camera_capture.

  • Teach the Intermediate Point(s)

    Intermediate points are between the picking pose and placing pose and are used to ensure that the robot doesn’t collide with the surrounding when moving between the picking and placing poses. You can add one or more intermediate points to waypoint of MoveL waypoint1.

  • Teach the Placing Pose

    Record the placing pose in drop.

  • Add the Object Picking and Releasing Logics for the Tool

    When the robot moves to the picking waypoint and the placing waypoint, you need to add the tool control logics for picking and releasing the object respectively.

  • Define Z-Offset from Picking/Placing Pose

    • Approach waypoint of placing

      MoveL RelTool(drop,0,0,-100): the Z-offset when approaching the placing pose is set to 100 mm. The robot will move to 100 mm above the placing pose.

    • Departure waypoint of placing

      MoveL Offs(drop,0,0,100): the Z-offset when departing the placing pose is set to 100 mm. The robot will move to 100 mm above the placing pose.

Obtain Planned Path from Mech-Vision

PROC Vision_Sample_3()
    !**********************************************************
    ! FUNCTION:Eye to Hand simple pick and place with vis Path Planning Step
    ! 2023-1-10
    !**********************************************************
    AccSet 100, 100;
    VelSet 100, 5000;
    MoveAbsJ Home\NoEOffs,v3000,fine,Gripp1TCP;!move robot home position
    MoveL camera_capture,v500,fine,Gripp1TCP;
    PoseNum:=0;
    !Set ip address of IPC
    MM_Init_Socket "127.0.0.1",50000,60;
    WaitTime 0.1;
    !Set vision recipe
    MM_Switch_Model 1,1;
    !Run vision project
    MM_Start_Vis 1,1,2,snap_jps;
    WaitTime 1;
    !get planned path from {product-vis} Path Planning Step
    MM_Get_VisPath 1,2,LastData,PoseNum,VisPosNum,Status;
    IF Status<>1103 THEN
        Stop;
    ENDIF
    FOR i FROM 1 TO PoseNum DO
        count:=i;
        MM_Get_Pose count,P{count},label1{count},speed{count};
    ENDFOR
    !follow the planned path to pick
    FOR j FROM 1 TO PoseNum DO
        count:=j;
        MoveL p{count},v1000,fine,Gripp1TCP;
        IF count=VisPosNum THEN
            Stop;
            !add object grasping logic here
        ENDIF
    ENDFOR
    !go to drop location
    MoveL RelTool(drop,0,0,-100),v1000,z50,Gripp1TCP;
    MoveL drop,v500,fine,Gripp1TCP;!drop point
    stop;
    !add object releasing logic here
    MoveL Offs(drop,0,0,100), v1000, fine, Gripp1TCP;
    MoveAbsJ Home\NoEOffs,v3000,fine,Gripp1TCP;
    RETURN ;
ENDPROC

Program Logic

  1. Move the robot to HOME position.

  2. Move the robot to the image-capturing pose.

  3. Initialize communication with MM_Init_Socket.

  4. If parameter recipes are used in the Mech-Vision project, the recipe to be used is set with MM_Switch_Model.

  5. Run the Mech-Vision project with MM_Start_Vis.

  6. Obtain the planned path from the “Path Planning” Step in Mech-Vision with MM_Get_VisPath.

  7. Check if the returned status code indicates any error. If an error code is returned, the program is stopped.

  8. Store obtained waypoint poses in the planned path to P{} with a FOR loop.

  9. Move the robot along the planned path with a FOR loop and perform picking.

  10. Move the robot to an intermediate point between the picking waypoint and placing waypoint.

  11. Move the robot to the set placing waypoint and perform placing.

Customization Required

  • Define the TCP (Tool Center Point)

    The TOOL is defined as Gripp1TCP. Change the value of Gripp1TCP to the actual TCP values.

  • Define HOME Position

    Set the Home position in Home.

  • Teach the Image-Capturing Pose

    Record the image-capturing pose in camera_capture.

  • Teach the Intermediate Point(s)

    Intermediate points are between the picking pose and placing pose and are used to ensure that the robot doesn’t collide with the surrounding when moving between the picking and placing poses. You can add one or more intermediate points to waypoint of MoveL waypoint1.

  • Teach the Placing Pose

    Record the placing pose in drop.

  • Add the Object Picking and Releasing Logics for the Tool

    When the robot moves to the picking waypoint and the placing waypoint, you need to add the tool control logics for picking and releasing the object respectively.

  • Define Z-Offset from Picking/Placing Pose

    • Approach waypoint of placing

      MoveL RelTool(drop,0,0,-100): the Z-offset when approaching the placing pose is set to 100 mm. The robot will move to 100 mm above the placing pose.

    • Departure waypoint of placing

      MoveL Offs(drop,0,0,100): the Z-offset when departing the placing pose is set to 100 mm. The robot will move to 100 mm above the placing pose.

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.