MoveFn()
It's an example code of a function to select and execute motion instructions. You can select among movel, movej, or movejx.
Sample Code: MoveFn()
# Select Motion
def MoveFn(mType, ref_Pos, ref_Vel, ref_Acc, ref_Time, ref_Radius, ref_Frame, ref_Mod, ref_Reactive, ref_Apptype, ref_Sol, sync_Mode):
# Input data (Example):
# mType = "movel"
# ref_Pos = posx(X, Y, Z, A, B, C) (if mType == "movej": posj(j1, j2, j3, j4, j5, j6))
# ref_Vel = 100 mm/s (if mType == "movej" or mType == "movejx" : 30 deg/s)
# ref_Acc = 100 mm/s^2 (if mType == "movej" or mType == "movejx" : 30 deg/s^2)
# ref_Time = 0 sec
# ref_Radius = 0 mm
# ref_Frame = DR_BASE
# ref_Mod = DR_MV_MOD_ABS
# ref_Reactive = DR_MV_RA_DUPLICATE
# sync_Mode = "sync" # ref_Apptype = None # ref_Sol = None
# Predefined Value
if ref_Apptype == None:
ref_Apptype = DR_MV_APP_NONE
if ref_Sol == None:
ref_Sol = get_current_solution_space() # Current Solution Space
if sync_Mode == "sync":
if mType == "movel":
movel(ref_Pos,vel=ref_Vel,acc=ref_Acc,time=ref_Time,radius=ref_Radius,ref=ref_Frame,mod=ref_Mod,ra=ref_Reactive, app_type=ref_Apptype)
elif mType == "movej":
movej(ref_Pos,vel=ref_Vel,acc=ref_Acc,time=ref_Time,radius=ref_Radius,mod=ref_Mod,ra=ref_Reactive)
elif mType == "movejx":
movejx(ref_Pos,vel=ref_Vel,acc=ref_Acc,time=ref_Time,radius=ref_Radius,ref=ref_Frame,mod=ref_Mod,ra=ref_Reactive,sol=ref_Sol)
elif sync_Mode == "async":
if mType == "movel":
amovel(ref_Pos,vel=ref_Vel,acc=ref_Acc,time=ref_Time,ref=ref_Frame,mod=ref_Mod,ra=ref_Reactive, app_type=ref_Apptype)
elif mType == "movej":
amovej(ref_Pos,vel=ref_Vel,acc=ref_Acc,time=ref_Time,mod=ref_Mod,ra=ref_Reactive)
elif mType == "movejx":
amovejx(ref_Pos,vel=ref_Vel,acc=ref_Acc,time=ref_Time,ref=ref_Frame,mod=ref_Mod,ra=ref_Reactive,sol=ref_Sol)
return True