Skip to main content
Skip table of contents

Sample Code - AppRet_Motion()

AppRet_Motion()

PY
# Approach/Retract Motion
def AppRet_Motion(app_ret_Dist, ref_Pos, AppRet_Vel, AppRet_Acc, AppRet_Time, AppRet_Radius, ref_Frame, ref_Mod, ref_Reactive, CaloffsetPos, MoveFn):
    # Input data (Example): 
    # app_ret_Dist = [X, Y, Z]
    # ref_Pos = posx(X, Y, Z, A, B, C)
    # AppRet_Vel = 100
    # AppRet_Acc = 100
    # AppRet_Time = 0
    # AppRet_Radius = 0
    # ref_Frame = DR_BASE 
    # ref_Mod = DR_MV_MOD_ABS
    # ref_Reactive = DR_MV_RA_DUPLICATE
    # Predefined Value
    app_ret_Frame = DR_TOOL
    mType = "movel"
    ref_Apptype = None
    ref_Sol = None
    sync_Mode = "sync"
    AppRet_Offset = [0, 0, 0]
    pos_temp = CaloffsetPos(ref_Pos, app_ret_Dist, app_ret_Frame, ref_Frame) 
    #tp_log("pos_temp = {0}".format(pos_temp))
    posAppRet = posx(pos_temp[0]+AppRet_Offset[0], pos_temp[1]+AppRet_Offset[1], pos_temp[2]+AppRet_Offset[2], pos_temp[3], pos_temp[4], pos_temp[5])
    #tp_log("posAppRet = {0}".format(posAppRet))
    MoveFn(mType, posAppRet, AppRet_Vel, AppRet_Acc, AppRet_Time, AppRet_Radius, ref_Frame, ref_Mod, ref_Reactive, ref_Apptype, ref_Sol, sync_Mode)
    return True
JavaScript errors detected

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

If this problem persists, please contact our support.