Definition
enable_alter_motion(n,mode,ref,limit_dPOS,limit_dPOS_per)
Features
enable_alter_motion() and alter_motion() functions enable altering of the motion trajectory.
This function sets the configurations for altering function and allows the input quantity of alter_motion() to be applied to motion trajectory. The unit cycle time of generating altered motion is 10msec. Cycle time(n*10msec) can be adjusted using the input parameter n.
This function provides two modes: Accumulation mode and Increment mode. Input quantity of alter_motion() can be applied to motion trajectory in two ways: as an accumulated value or as an incremental value.
-
In Accumulation mode, the input quantity means the absolute altering amount from current motion trajectory.
-
In Increment mode, the input quantity means the incremental value from the previous absolute altering amount.
The reference coordinate can be changed through input parameter ref. Limitations for accumulation amount and increment amount can be set using input parameters limit_dPOS (accumulated limit) and limit_dPOS_per(incremental input limit during one cycle). The actual altering amount is constrained by these limits.
Parameters
|
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
|
n |
int |
None |
Cycle time number |
|
mode |
int |
None |
Mode
|
|
ref |
int |
None |
reference coordinate
|
|
limit_dPOS |
list(float[2]) |
None |
First value : limitation of position[mm] Second value : limitation of orientation[deg] |
|
limit_dPOS_per |
list(float[2]) |
None |
First value : limitation of position[mm] Second value : limitation of orientation[deg] |
Note
-
_global_ref is applied if ref is None
-
Accumulation amount or increment amount will not be limited if limit_dPOS or limit_dPOS_per is None.
-
alter_motion() can be executed only in user thread.
Exception
|
Exception |
Description |
|---|---|
|
DR_Error (DR_ERROR_TYPE) |
Parameter data type error occurred |
|
DR_Error (DR_ERROR_VALUE) |
Parameter value is invalid |
|
DR_Error (DR_ERROR_RUNTIME) |
C extension module error occurred |
|
DR_Error (DR_ERROR_STOP) |
Program terminated forcefully |
Example
def alter_thread():
global dir_a, wait_time
alter_motion(dX) #dX : amount of alter motion
if dX[0] > 9.9:
dir_a = -10
elif dX[0] < -9.9:
dir_a = 10
dX[0] = dX[0] + dir_a
dX[3] = dX[3] + dir_a
wait(wait_time)
dX = [10,0,0,10,0,0]
# Starting from V3.4, various orientation types are supported depending on the ori_type setting in posx():
# dX = posx([10, 0, 0, 0, 0, 10], ori_type=DR_ELR_ZYZ, sol=None, turn=None)
J00 = posj(30,45,45,0,90,0)
movej(J00,vel=100,acc=100)
X1,sol = get_current_posx(DR_BASE)
J01 = posj(-30,45, 45,0,90,0)
movej(J01,vel=100,acc=100)
X2,sol = get_current_posx(DR_BASE)
# Alter motion is executed during the cycle time
cycle_time = 0.6
n_period = int(cycle_time * 1000 / 50)
wait_time = cycle_time
# cycle time:(n_period * 10)msec, mode:accumulate, reference coordination:base coordination
# Lmitation of accumulation amount :50mm, 90deg
# Limitation of increment amount :60mm, 60deg
# Limit Alarm can occur if the cycle time is too short compare to the amount of alter motion
enable_alter_motion(n=n_period,mode=DR_DPOS, ref=DR_BASE, limit_dPOS=[50,90], limit_dPOS_per=[60,60])
th_id = thread_run(alter_thread, loop=True)
movel(pos=X1,vel=10,acc=100)
movel(pos=X2,vel=10,acc=100)
thread_stop(th_id)
disable_alter_motion() # deactivates alter motion