Skip to main content
Skip table of contents

통합예제 - SVM

예제

Vision 작업 설정 상태

  • WCM에 저장된 모든 작업을 삭제한 후 아래와 같이 비전작업/툴을 생성한다.
  • 비전작업생성: vision_test (position tool, 1000)
  • 비전 툴 추가: print_insp (presence tool, 1001), box_size (distance tool, 1002)
  • TW에서 Vision Command “vision_test” 작업을 선택하고, 변수정보를 설정한다.
  • Custom code에 아래 예제를 추가하여 테스트를 진행한다.
PY
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
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.