Integrated example (SVM)
Example
Vision Job setting status
- After deleting all the jobs saved in WCM, create vision task / tool as below.
- Create vision task : vision_test (position tool, 1000)
- Add vision tools: print_insp (presence tool, 1001), box_size (distance tool, 1002)
- Select the "vision_test" task in TW vision command set the variable information.
- Add the following example to your custom code to test.
svm_connect() # Connect to vision
vision_test=1000 # Define vision job ID
print_insp=1001 # Define inspection tool ID
box_size=1002 # Define measurement tool ID
svm_set_job(vision_test) # Load the vision_test (1000)
movej(svm_get_robot_pose(vision_test), vel=10, acc=20) # Move to shoot pose (movej)
if (svm_get_vision_info(vision_test)== 1): # Execute the vision measurement
# Load the vision variables
# Get the position information (posx) of vision_test tool
pos_result=svm_get_variable(vision_test, POSX_TYPE)
tp_popup("pos_result {0}".format(pos_result))
# Get the inspection information (PASS or Fail) of print_insp tool
inspection_result=svm_get_variable(print_insp, INSP_TYPE)
tp_popup("inspection_result {0}".format(inspection_result))
# Get the distance information (distance) of box_size tool
measurement_result= svm_get_variable(box_size, VALUE_TYPE)
tp_popup("measurement_result {0}".format(measurement_result))
# Move to the vision guided robot pose
# Get the vision guided robot pose
ld_list =[vision_test]
pos_list =[pos_result]
svm_set_init_pos_data(Id_list,pos_list)
rob_posx=svm_get_offset_pos(posx(200,200,100,0,180,0), vision_test)
tp_popup("rob_posx {0}".format(rob_posx))
# move to the rob_posx
movel(rob_posx, vel=30, acc=100)
svm_disconnect() # Disconnect to vision