프로그램

로봇이캘리브레이션되면캘리브레이션된로봇의절대정확도를사용하여프로그램을생성하는두가지옵션이있습니다.

o기존프로그램필터링: 프로그램내부의모든로봇대상이로봇의정확도를향상하도록수정되었습니다. 수동으로또는 API를사용하여수행할수있습니다.

오프라인프로그램에 RoboDK를사용하여정확한프로그램을생성하십시오 (API를사용하여생성된프로그램을포함하여생성된프로그램은이미필터링되어있습니다).

기존프로그램을수동으로필터링하려면로봇프로그램파일을 RoboDK의메인화면으로끌어다놓은후(또는파일➔열기선택) 필터를선택하십시오. 프로그램이필터링되어같은폴더에저장됩니다. 필터링알고리즘을사용하는데문제가있으면필터요약에언급됩니다. 또한, RoboDK 내에서프로그램을시뮬레이션하려는경우프로그램을가져올수있는옵션이있습니다. 프로그램에종속성(툴좌표계또는기본좌표계정의, 서브프로그램등)이있는경우첫번째프로그램을가져오는같은디렉토리에있어야합니다.

Robot Calibration Creaform - 영상 33

Robot Calibration Creaform - 영상 34

RoboDK로프로그램을가져오면절대정확도의유무와관계없이재생성할수있습니다. RoboDK의주요정확도설정(도구➔옵션➔정확도)에서항상정확한운동학을사용하여프로그램을생성할것인지, 매번묻기를원하거나현재로봇운동학을사용하려는지를결정할수있습니다. 로봇을마우스오른쪽버튼으로클릭하고 "정확한운동학사용" 태그를활성화/비활성화하여현재로봇운동학을변경할수있습니다. 활성화되어있으면녹색점이표시되고활성화되어있지않으면빨간색점이표시됩니다.

Robot Calibration Creaform - 영상 35

Robot Calibration Creaform - 영상 36

API 필터 프로그램

보정된로봇과필터프로그램호출을사용하는로봇프로그램이주어지면 RoboDK를사용하여완전한프로그램을필터링할수있습니다.

robot.FilterProgram(file_program)

FilterProgram이라는매크로예제는라이브러리의매크로섹션에서사용할수있습니다. 다음코드는 RoboDK API를사용하여프로그램을필터링하는예제 Python 스크립트입니다.

from robolink import *    # API to communicate with RoboDK

from robodk import *      # basic matrix operations

import os                 # Path operations

 

# Get the current working directory

CWD = os.path.dirname(os.path.realpath(__file__))

 

# Start RoboDK if it is not running and link to the API

RDK = Robolink()

# optional: provide the following arguments to run behind the scenes

#RDK = Robolink(args='/NOSPLASH /NOSHOW /HIDDEN')

 

# Get the calibrated station (.rdk file) or robot file (.robot):

# Tip: after calibration, right click a robot and select "Save as .robot"

calibration_file = CWD + '/KUKA-KR6.rdk'

 

# Get the program file:

file_program = CWD + '/Prog1.src'

 

# Load the RDK file or the robot file:

calib_item = RDK.AddFile(calibration_file)

if not calib_item.Valid():

    raise Exception("Something went wrong loading " + calibration_file)

 

# Retrieve the robot (no popup if there is only one robot):

robot = RDK.ItemUserPick('Select a robot to filter', ITEM_TYPE_ROBOT)

if not robot.Valid():

    raise Exception("Robot not selected or not available")

 

# Activate accuracy

robot.setAccuracyActive(1)

# Filter program: this will automatically save a program copy

# with a renamed file depending on the robot brand

status, summary = robot.FilterProgram(file_program)

 

if status == 0:

    print("Program filtering succeeded")

    print(summary)

    calib_item.Delete()

    RDK.CloseRoboDK()

else:

    print("Program filtering failed! Error code: %i" % status)

    print(summary)   

    RDK.ShowRoboDK()

API 필터 타겟

다음코드는필터 타겟명령을사용하여 RoboDK API를사용하여대상(포즈대상또는조인트대상)을필터링하는예제 Python 스크립트입니다.

pose_filt, joints = robot.FilterTarget(nominal_pose, estimated_joints)

이예제는타사응용프로그램(RoboDK 이외)이포즈대상을사용하여로봇프로그램을생성하는경우에유용합니다.

from robolink import *    # API to communicate with RoboDK

from robodk import *      # basic matrix operations

 

def XYZWPR_2_Pose(xyzwpr):

    return KUKA_2_Pose(xyzwpr) # Convert X,Y,Z,A,B,C to a pose

   

def Pose_2_XYZWPR(pose):

    return Pose_2_KUKA(pose) # Convert a pose to X,Y,Z,A,B,C

 

# Start the RoboDK API and retrieve the robot:

RDK = Robolink()

robot = RDK.Item('', ITEM_TYPE_ROBOT)

if not robot.Valid():

    raise Exception("Robot not available")

 

pose_tcp = XYZWPR_2_Pose([0, 0, 200, 0, 0, 0]) # Define the TCP

 

pose_ref = XYZWPR_2_Pose([400, 0, 0, 0, 0, 0]) # Define the Ref Frame

 

# Update the robot TCP and reference frame

robot.setTool(pose_tcp)

robot.setFrame(pose_ref)

 

# Very important for SolveFK and SolveIK (Forward/Inverse kinematics)

robot.setAccuracyActive(False) # Accuracy can be ON or OFF

 

# Define a nominal target in the joint space:

joints = [0, 0, 90, 0, 90, 0]

 

# Calculate the nominal robot position for the joint target:

pose_rob = robot.SolveFK(joints) # robot flange wrt the robot base

 

# Calculate pose_target: the TCP with respect to the reference frame

pose_target = invH(pose_ref)*pose_rob*pose_tcp

 

print('Target not filtered:')

print(Pose_2_XYZWPR(pose_target))

 

joints_approx = joints # joints_approx must be within 20 deg

pose_target_filt, real_joints = robot.FilterTarget(pose_target, joints)

print('Target filtered:')

print(real_joints.tolist())

print(Pose_2_XYZWPR(pose_target_filt))