Example Programs 1: Get Vision Result from Mech-Vision

You are currently viewing the documentation for the latest version (2.2.0). To access a different version, click the "Switch version" button located in the upper-right corner of the page.

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

Program Introduction

Description

The robot triggers the Mech-Vision project to run, and then obtains the vision result for picking and placing the object.

Project

Mech-Vision project

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

The following is a sample program for reference only.

The table below explains the above example program. You can click the hyperlink to the command name to view its detailed description.

Feature Code and description

Initialize communication parameters

mm_init_socket

mm_init_socket: The command to initialize the communication.

  • '192.168.10.182': The IP address of the IPC.

  • 50000: The port number of the IPC.

The entire statement indicates that the robot establishes the connection with the vision system by specifying the IP address, port number, and timeout period of the communication target (the IPC) through the mm_init_socket command.

Please modify the IP address and port number of the IPC according to the actual situation. The IP address and port number must be consistent with those set in the vision system.

Move to the image-capturing position

MoveJ
	path_0
  • MoveJ: The joint position motion command of the AUBO ARCS robot, indicating that the robot moves along the arc to a specified position.

  • path_0: Specify the target position to which the robot moves, i.e., the image-capturing position that is taught. The image-capturing position refers to the position of the robot where the camera on the robot captures images. At this position, the robot arm should not block the camera’s FOV.

You should teach the image-capturing position in advance. For detailed instructions, see Teach Calibration Start Point in the calibration document.

Establish the communication

mm_open_socket

The TCP communication between the robot and the vision system is established by using the mm_open_socket command.

Trigger the Mech-Vision project to run

mm_start_vision

mm_start_vision: The command to trigger the Mech-Vision project to run.

  • 2: The Mech-Vision project ID.

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

  • Current Position: Send the robot’s current joint positions and flange pose to the Mech-Vision project.

  • 90,90,90,90,90,90: Because the preceding parameter is set to Current Position, the joint angle values here are not used, and the user does not need to modify them.

The entire statement indicates that the robot triggers the vision system to run the Mech-Vision project with an ID of 2 and expects the Mech-Vision project to return all vision points.

Get Vision Result

mm_get_data

mm_get_data: The command to obtain the vision result.

  • From Vision: Retrieve Mech-Vision output data.

  • mm_get_vis_data: The command to obtain the vision result.

  • 2: The Mech-Vision project ID.

  • pose_num: The variable that stores the number of received vision points.

  • g_mm_status(global variable): The variable that stores the command execution status code.

The entire statement indicates that the robot obtains the vision result from the Mech-Vision project with an ID of 2.

The returned vision result is saved to the robot memory and cannot be directly obtained. To access the vision result, you must store the vision result in a subsequent step.

Store the vision results and move to the picking waypoint.

If g_mm_status==1100

When the status code is 1100, the robot has successfully obtained all vision result. Otherwise, an error has occurred in the vision system. You can perform the corresponding operation based on the specific error code.

aaa:=1
loop_0 aaa<=pose_num
	i_pose1:={}
    mm_get_posjps
	MoveJ
		i_pose1
	aaa:=aaa+1
  • aaa: This variable controls the loop count and specifies the waypoint index; initial value is 1.

  • loop_0 aaa <= pose_num: Iterate through all waypoints, retrieving each waypoint data and moving to the corresponding position.

  • i_pose1: A variable used to store waypoint joint-angle data; initial value is {}.

  • mm_get_posjps: The command to obtain the vision result.

    • mm_get_jps: Stores the TCP, label, and tool ID of the waypoint in the variables.

    • aaa: Specifies the index of the waypoint whose data will be transferred/saved; for example, aaa = 1 indicates that the data of the first waypoint will be transferred/saved.

    • i_pose1: This variable stores the tool pose of the No.aaa vision point, i.e., tool pose of the picking waypoint.

    • l1: The variable that stores the tool ID corresponding to the No.aaa waypoint.

    • s1: The variable that stores the label of the No.aaa waypoint.

    Therefore, the entire statement stores the TCP, label, and tool ID of the No.aaa vision point to the specified variables, respectively.

  • MoveJ i_pose1: Moves the robot to the picking waypoint(vision point) using joint position movement.

    • After the robot moves to the picking waypoint, you can set a DO command to control the robot to use the tool to perform picking.

    • Adding departure waypoints of placing can prevent the robot from colliding with objects (such as bins) in the scene when moving.

Close the communication

mm_close_socket

The TCP communication between the robot and the vision system is closed by using the mm_close_socket command.

Is this page helpful?

You can give a feedback in any of the following ways:

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.