Example Programs 3: Get Planned Path 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 planned path for picking and placing.

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.

  • 1: The Mech-Vision project ID.

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

  • 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 1 and expects the Mech-Vision project to return all waypoints.

Obtain the planned path

mm_get_data

mm_get_data: The command to obtain the vision result.

  • From Vision (retrieve Mech-Vision output data)

  • mm_get_vis_path: The command to obtain the planned path.

  • 1: The Mech-Vision project ID.

  • 1: Specify the pose type of obtained waypoints as joint positions.

  • pose_num: The variable that stores the number of waypoints returned by the vision system.

  • ss: This variable stores the sequence number of the Vision Move waypoint (picking waypoint) in the path.

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

The entire statement indicates that the robot obtains the planned path from the Mech-Vision project that has an ID of 1.

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

Retrieve the planned path and move to each waypoint

If g_mm_status==1103

When the status code is 1103, the robot has successfully obtained the planned path. 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 joint positions, 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: The variable that stores the joint positions of the No.aaa 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.

    The entire statement stores the TCP, label, and tool ID of the No.aaa vision point in the specified variables.

  • MoveJ i_pose1: Moves the robot to the waypoint using joint position movement.

  • The variable ss represents the index of a vision-guided motion waypoint within the path; therefore, the waypoint at index ss in the path is the picking waypoint.

  • 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.