轴电机运动管理命令
- ENABLE &DISABLE
Enable命令激活一个或多个电机和轴
Disable命令关闭一个或多个电机轴。
错误码存储在MERR中,可以用FCLEAR来清除
只要是电机是使能的,控制器器提供下面工作:
1)保持ENA电机在激活状态
2)计算PE(非关键性的位置错误)
3)执行闭环控制(对于伺服电机)
4)检查PE的条件和其它错误,在需要的时候,将相应的错误位置1
下面的变量/位能够改变Enable命令的执行行为
ENTIME |
Defines the time (or maximum time) of ENABLE execution |
MFLAGS.#ENMOD |
Defines the mode of ENABLE execution |
FMASK.#DRIVE |
Defines if the drive alarm fault is processed |
SAFINI.#DRIVE |
Defines an active level of the drive alarm safety signal |
当MFLAGS.#ENMOD位是1时候
ENTIME 值定义了enable执行的时间。当执行Enable命令,ACSPL+程序总是等待ENTIME毫秒,然后查看驱动报警错误码是否是0,如果是0,认为Enable命令执行成功,否则Enable命令执行失败。
当 MFLAGS.#ENMOD位是0时候
ENTIME 值定义了enable执行的最大时间。执行Enable命令时候,一个ACSPL+程序监控驱动警告信号输入。只有驱动的警告信号不再激活,就认为Enable命令执行完成。如果在ENTIME毫秒内,驱动的ALARM信号一直在激活状态,说明ENABLE命令执行失败。
语法:
ENALBE axis_specification
DISABLE axis_specification[,reason]
例子,
ENABLE 0 Enable axis 0
ENABLE (2,3) Enable axes 2 and 3
DISABLE 2,5011 Disable axis 2, store 5011 as a disable reason. Code 5011 corresponds to left limit error, therefore the 2 axis motor will be
reported as disabled due to fault involving left limit.
DISABLE (2,3) Disable motors of axes 2 and 3
- COMMUT
COMMUT执行自动换向功能,在下面条件成立时候,才生效:
a)电机是直流无刷电机或交流伺服电机
b)电机是使能的
c)电机处于Idle,也就是不在移动状态
语法:
COMMUTaxis, [excitation_current,] [settle_time,] [slope_time][gantry_commut_delay]
参数
axis |
Specifies the motor to start commutation. |
excitation_current |
Specifies the motor current used during autocommutation. The current is specified in a percentage of the maximal value. The controller restricts the actual current value by the XCURI value. The argument can be omitted in which case the default value is 0.98*XRMS. You may wish to specify a greater value if the axis static friction is high, or a lower value if the axis static friction is low. |
settle_time |
Specifies the settling time in the autocommutation process in milliseconds. The argument can be omitted in which case the default value is 500 milliseconds. You may wish to specify a greater value in case of low-bandwidth or slow damping systems. |
slope_time |
Specifies the time that the excitation current rises from zero to the desired value. The argument can be omitted in which case the default value is 0 providing an immediate build-up of the excitation current. Slope time is required only in special cases and it is usually recommended to omit this argument in which case the excitation current is built instantly. |
gantry_commut_delay |
Optional – can be used only in Gantry mode. It defines the delay time in milliseconds after the commutation of the primary axis is completed and before the commutation of the complimentary axis begins. The default value is 500 msec. |
如果是空气轴承系统,EXCITATION_CURRENT设置低一些
如果是摩擦阻力大的系统,EXCITATION_CURRENT设置高一些
- KILL 和
KILL命令将终止一个或多个轴的停止,减速度由KDEC设定
KILLALL命令终止所有轴的动作。
语法:
KILL axis_specification [,cause]
KILLALL [,cause]
下面例子演示了不同情况下的KILL执行。
a) KILL命令,电机状态Idle
假设当前运动没有不包含2轴电机。
KILL 2不会影响任何运动
KILL 2, 6100也不会影响电机运动,但会存储6100错误码到MERR(2)中
b)KILL命令,单轴运动,默认connection
假设当前电机轴1执行运动PTP/V 1, 6000,
KILL 1,命令执行的话,电机开始从当前速度开始减速,减速度放在KDEC(1)中,减速时间=V1/KDEC(1)
c)KILL命令,多个单轴运动,默认connection
假设轴0,2,4执行独立的单轴运动。
KILL (0,2,4), 6088 效果等同于KILL 0,6088;KILL 2,6088; KILL 4, 6088
他们执行是独立的,根据各轴的即时速度,与减速度不一样,时间也可能不一样。
d)KILL命令,多轴运动,默认connection
假定运动MPTP(0,1,4)在执行
KILL 1, KILL (1,4), KILL(0,1,4)都会将三轴停下来。
e)KILL命令,非默认connection
CONNECT RPOS(2) = APOS(0) + APOS(2) - APOS(4)
DEPENDS 2,(0,2,4)
在这种情况下,KILL 2 将停下0,2,4三轴。
- FCLEAR
FLCEAR命令清除当前故障和先前存在MERR中的故障码,
语法:
FCLEAR[axis_specification]
如果轴指定了,则清除当前轴的错误码,FAULT和MERR
如果指定关键字ALL,则清除所有轴的错误
如果省略指定轴,则清除系统故障
- SET
语法:
SET axis_VAR =expression
FPOS |
Feedback Position |
F2POS |
Secondary Feedback Position |
RPOS |
Reference Position |
APOS |
Axis Reference Position |
SET FPOS(0) = 0
一般情况下,FPOS = RPOS,但有不是0误差的情况,比如
?RPOS(0), FPOS(0) Query RPOS and FPOS for the 0 axis
6000 The RPOS and FPOS differ by 2 counts due to, for instance, the bias in the amplifier
6002
SET RPOS(0) = 0 Set RPOS to 0 for the 0 axis
?RPOS(0), FPOS(0) Query RPOS and FPOS for the 0 axis
0 RPOS is set to exact zero
2 FPOS is set to 2 in the current point in order to retain the offset between RPOS and FPOS
SET FPOS(0) = 0 Set FPOS to 0 for the 0 axis
?FPOS(0), RPOS(0) Query RPOS and FPOS for the 0 axis
0 FPOS is set to zero in the current point
-2 RPOS is set to -2 in order to retain the offset between RPOS and FPOS
SET F2POS(0) = 0
- GROUP,SPLIT和SPLITALL
GROUP,SPLIT和SPLITALL管理多轴运动中的轴,将这些轴组合在同一个坐标系统。用SPLIT, 与SLITALL命令将它们在解组分开。
语法:
GROUP axes_specification
SPLIT axes_specificaiton
SPLITALL
例子,
GROUP (0,2,3)
创建了一个轴的群组,里面包含轴0,2,和3
- GO
GO命令启动一个运动,创建时用/w开关,如果创建运动时没有/w,就会自动启动,不需要GO命令
语法:
GO axes_specification
例子,
a)启动单轴运动
PTP/w 0, 1000 Create the motion, but do not start it
GO 0 Start the motion
b)启动一般运动
PTP/w 0, 1000 Create the motion, but do not start it
TILL IN0.1 Wait until input 1 is activated
GO 0 Start the motion
c) 同步几个运动的启动
PTP/w (0,1), 1000,1000 Create the motion, but do not start it
PTP/w 2, 8000 Create the motion, but do not start it
GO (0,1) Start both motions synchronously
- HALT
停止一个运动
语法:
HALT axes_specification
可以停止:单轴运动,组群轴的运动,多个运动
- BREAK
BREAK命令常用在停止一个运动转到另一个运动情形下。
语法:
BREAK axes_specification
可以终止:单轴运动,多轴运动,多个运动。
- IMM
IMM命令可以提供一个在线飞行的运动参数改变:速度,加速度,减速度,抖动,杀死减速度。
语法:
IMM motion_Var = command
VEL |
Velocity |
ACC |
Acceleration |
DEC |
Deceleration |
JERK |
Jerk |
KDEC |
Kill deceleration |
与赋值命令ASSIGNMENT不同的是,它是即时改变运动状态。
IMM命令必须改变的是一个单轴运动的轴变量或轴群组的首轴的参数。
- 点到点运动
- PTP
PTP生成指定轴到指定点的运动。
当PTP指定轴时,运动配置根据该轴的VEL,ACC,DEC,JERK来计算。
在组群运动时,PTP制定了多轴,配置基于首轴的VEL,ACC,DEC,JERK,来计算,除非显式的用PTP/m,来使用群里所有电机参数。
PTP命令的终止,一般有以下几个原因:
a)由新的运动命令终止
b)故障发送导致运动终止或杀死运动进程
c)用户通过命令HALT,KILL,BREAK手动终止。
语法:
PTP[switches]axis_list, destination-point[,value for v, value for f, motor_movement_delay]
参数:
axis_list |
Single axis or axis group, valid numbers are: 0, 1, 2, ... up to the number of axes in the system minus 1. |
destination point |
Final destination. |
value for v |
Optional argument for user-defined velocity. |
value for f |
Optional argument for user-defined velocity at a destination point |
motor_movement_delay |
(Optional, used only with /q switch) Delay, in milliseconds, before motor motion actually starts. |
开关:
/e |
Wait for motion termination before executing next command. |
/f |
Specify non-zero velocity at each destination point (or points) in a series of PTP motions |
/m |
Use the motion profile values of the axis group as a whole, rather than those of the leading axis, without exceeding any of the defined axes motion VEL, ACC, DEC, JERK values. |
/r |
The destination point is relative to the start point. |
/v |
Use the specified velocity instead of the default velocity (VEL). |
/w |
Create the motion, but do not start until GO. |
/z |
Interpret entered coordinates according to the Local Coordinate System. |
/q |
Defines actual motor movement delay in microseconds. The delay resolution is 50 microseconds.The maximum delay is 100 controller cycles: 100ms for CTIME=1ms or 20ms for CTIME=0.2ms.Allows delaying actual motor movement start (RPOS) for the specified delay, while motion profile generation (APOS) starts immediately. |
讨论:
1)轴的目标点和相对速度在PTP命令中也可以是一个表达式
2)PTP可以给组群的轴执行点到点的运动,PTP(0,1,2)给轴群组0,1,2创建了一个运动。
3)在单轴的PTP运动中,最后速度(由/f开关指示)可以是负值。在这种情况下,代表指定坐标点的速度是与运动方向相反的。
4)在单轴PTP运动中,如果运动是负向的,GVEL可以是负值。
COM库中的方法:
ToPoint
C 库中的函数:
acsc_ToPoint
例子1,
PTP/v 1, 2000, 500 !PTP axis 1 to point 2000 with velocity 500
例子2,
PTP/rw (0,1), 1000, 2000 !PTP axes 0 and 1 where the 1 target point is 1000 !and the 0 target point is 2000. The target points !are relative to the start point. Motion will not !commence until GO command is issued.
例子3,
ENABLE 0 !Enables axis 0VEL(0)=10000 !Sets the default axis 0 velocity to 10000SET RPOS(0)=0 !Sets the current axis 0 position to 0PTP/rf 0, 2000, 1000 !Initiates a relative axis 0 motion of 2000 with end !velocity of 1000 at the destination pointPTP 0, 4000 !Initiates an absolute axis 0 motion to 4000STOP !Ends program
- SPTP
SPTP命令一般用于多轴的点到点运动,语法类似于PTP命令。不同于PTP,SPTP用的是4阶运动规划。ACS常规的运动指令,比如PTP,是三阶运动规划,有VEL/ACC/JERK。4阶运动规划是指有VEL/ACC/JERK/SNAP,SNAP是JERK的微分。
语法:
SPTP[/switches] axis_list, target_point[, velocity]
参数:
axis_list |
Motion axes designation. |
target_point |
Target point coordinates |
velocity |
Optional argument for user-defined velocity |
开关:
/e |
Wait for motion termination before executing next command |
/v |
Use the specified velocity instead of the default velocity (VEL). |
/w |
Create the motion, but do not start until the GO command is issued |
/z |
Move relative to Local Coordinate System |
讨论:
SPTP看起来像PTP命令,不同于PTP,SPTP用4阶运动规划
SPTP命令可以带单轴或轴组作为参数。
例子,
SPTP (X,Y,Z) 100, 100, 300
- Move和Settle时间的计算
ACSPL+支持点到点运动的测量。一个运动完成是由进入目标点的预定义的圆半径内,并停留预定义的时间。
三个停留半径变量:TARGRADA,TARGRADB,TARGRADC。
三个停留时间变量:SETTLEA,SETTLEB,SETTLEC。
就ACSPL+变量来说,这个标准就是说abs(TPOS-FPOS) < TARGRADA/B/C,维持一段时间SETTLEA/B/C.
当这些移动与稳定下来的特征被SETCONF(318)激活到单个模式1或自动模式2。运动停留在半径TARGRAD<x>时间就会被记录下来,放到变量MSTIMEA,MSTIMEB和MSTIMEC中。
例子代码:
! User units – mm!Example 1 – Motor is settled to 1 micron window! Window ATARGRADA(0) = 1e-3 !Set threshold to 1umSETTLEA(0) = 100 ! Stay in window for 100ms till assigning value to MSTIMEA! Example 2 – Motor is settled to 75 micron window – in this case the motor is considered settled before the motion is completed! Window BTARGRADB(0) = 80e-3 !Set threshold to 80umSETTLEB(0) = 150 ! Stay in window for 150ms till assigning value to MSTIMEB! Window CTARGRADC(0) = 1e-3 !Set threshold to 1umSETTLEC(0) = 5 ! Stay in window for 5ms till assigning value to MSTIMECsetconf(318, 0, 1)!Example 3 !setconf(318, 0, 2) !Uncomment for running example 3enable(0)PTP/e(0), 1wait 1000PTP/e(0), 0stop
例子1结果:
例子2结果:
例子3结果:
- MPTP,POINT,MPOINT 和ENDS
这些命令支持多点运动
语法:
MPTP [/switch] axis_designators [,dwell_time][, motor_motion_delay]
POINT axis_designators, coordinate [,coordinate] [,velocity]
MPOINT axis_designators, point_matrix, number_of_points
ENDS
开关:
w |
Create the motion, but do not start until the GO command has been issued. |
v |
Use the velocity specified in the command instead of the default velocity. |
r |
Treat points as relative. |
c |
Use the point sequence as a cyclic array: after positioning to the last point do positioning to the first point and continue. |
z |
Interpret entered coordinates according to the Local Coordinate System. |
q |
Defines actual motor movement delay in microseconds. The delay resolution is 50 microseconds.The maximum delay is 100 controller cycles: 100ms for CTIME=1ms or 20ms for CTIME=0.2ms.Allows delaying actual motor movement start (RPOS) for the specified delay, while motion profile generation (APOS) starts immediately. |
a) MPTP
用MPTP命令指定轴和等待时间
MPTP 0,1000
上面的命令创建了0轴上的一个多点运动,在每个点上停留1000ms。如果不需要停留,。第二个参数停留时间可以忽略。创建的运动并不会立即运动,直到至少一个目标点给出。这些点是由POINT或MPOINT给出的,常常跟在MPTP命令后面,考虑下面的程序片段:
MPTP (0,1) Create multipoint motion in group (0,1) with no dwell time.POINT (0,1), 0, 100 Add first point.POINT (0,1), 100, 200 Add second point.POINT (0,1), 200, 100 Add third point.POINT (0,1), 100, 0 Add fourth point.ENDS (0,1) End the point sequence.
例子1:
MPTP/w 0, 1000
运动不会启动直到命令GO 0 发出。
例子2:
PTP (0,1), 0, 100 Create PTP motion to the first point (this serves as the reference point).MPTP/r (0,1) Create multipoint motion in group (0,1) with no dwell time.POINT (0,1), 100, 100 Add point.POINT (0,1), 100, -100 Add point.POINT (0,1), -100, -100 Add point.ENDS (0,1) End the point sequence.
例子3:
MPTP/v (0,1) Create multipoint motion in group (0,1) with no dwell time.POINT (0,1), 0, 100, 30000 Move to first point at velocity 30000.POINT (0,1), 100, 200, 10000 Move to second point at velocity 10000.POINT (0,1), 200, 100, 5000 Move to third point at velocity 5000.POINT (0,1), 100, 0, 10000 Move to fourth point at velocity 10000.ENDS (0,1) End the point sequence.
b) POINT
POINT命令增加目标点到多点或任意运动路径
例子
MPTP/v (0,1) Create multipoint motion in group (0,1) with no dwell time.POINT (0,1), 100, 0, 30000 Move to first point at velocity 30000.POINT 1, 100 Move to second point at velocity 30000.POINT 0, 200 Move to third point at velocity 30000.POINT 1, 0, 10000 Move to fourth point at velocity 10000.ENDS (0,1) End the point sequence.
四个点的序列如下,
c)MPOINT
是存放多点数组
例子:
real Points(50)(6) Declare an array of 50 points for each of six axes. The host will write the coordinates to the array.int Sync Declare synchronization variable.MPTP (0,1,2,4,5) Create multi-point motion for axes 0, 1, 2, 3, 4 and 5.WHILE Sync >= 0 Continue until the host writes negative number to Sync.TILL Sync Wait until the points are received. Once the host has filled the Points array, it writes the Sync variable with a number of points written to the Points array.IF Sync > 0 Sync < 0 indicates that the host has finished the point generation.MPOINT (0,1,2,4,5), Points, Sync Add points from the Points matrix.Sync = 0 The controller informs the host that the next batch is expected. At this moment the motion through the accepted points has not finished, but the controller is ready to receive more points.END End if.END End while.ENDS (0,1,2,4,5) End mptp.STOP End program.
翻译成主机伪代码,
double HPoints(50)(6);int N, HSync, NBuf;HANDLE Com;open communication, start program in buffer NBuf of the controller;while (Continue)calculate N (<= 50) points in array HPoints;acsc_WriteReal(Com, NBuf, "Points", 0, N-1, 0, 6, HPoints, 1000) ;acsc_WriteInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &N, 0);doacsc_ReadInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &HSync, 0);while HSync;reset Continue to zero if all points have been calculated;end;N = -1acsc_WriteReal(Com, NBuf, "Points", 0, N-1, 0, 6, HPoints, 0) ;
主机和控制器之间的同步是由SYNC变量提供的。当主机完成了一批点到控制器,将点数写到SYNC中。控制器等待非零的SYNC,然后将这些点增加到运动中。当控制器完成增加点,就写0到SYNC中,意味着主机可以继续传送下一批点。
当主机程序结束了,写-1到SYNC中,意味着整个运动结束。
- GRTIME变量
GRTIME变量是8元素的实数数组。GRTIME用毫秒为单位显示了一个运动的全过程所花的时间,直至运动结束。GRTIME在PTP与TRACK运动中有效。
a)GRTIME中的元素是一个轴的。
b)如果轴是不动的,里面的元素都是0
c)刚开始的一个值是无效的,给它赋值一个大数
d)版本4.5中不合法的周期短了,但精确的阶段划分并不保障,只是示意刻画运动全貌,
- 模态轴
MFLAGS变量的Bit29(#MODULE0)指定了模态轴。轴反馈在指定最大最小位置。
SLPMIN
SLPMAX
- SPTP
- Move和Settle时间的计算
- MPTP,POINT,MPOINT 和ENDS
- GRTIME变量
运动增强
a)20k Hz运动
一般地,分辨率是由控制器周期决定的CTIME,但是如果指定了20kHZ功能,分辨率就变成了20kHz
下面对比图,显示了20kHZ运动轨迹更光滑。
b)BPTP
BPTP定义了运动增强的运动规划。
语法:
BPTP[/switch] axis_list, destination_point, [value of Tf, value of Vf, motor_motion_delay]
开关:
Arguments |
Comments |
None |
Travel time will be calculated by the MPU to achieve a the minimum possible time |
/t |
Minimum travel time in seconds, The calculated travel time will be at least the specified value. Incompatible with the /d switch. |
/d |
Travel Time – specifies the exact travel time for the motion in seconds.All other considerations are ignored, which could cause a safety fault during motion execution.Incompatible with the /t switch. |
/f |
User will enter final, nonzero velocity. In single axis motion the sign of the final velocity parameter has no effect, only the absolute value is considered. |
/e |
Wait for motion termination before executing next command. |
/r |
Relative motion |
/v |
Use velocity parameter instead of default velocity parameters. |
/w |
Create the motion, but to not start until the GO command is issued. |
/z |
Interpret entered coordinates according to the Local Coordinate System. |
/m |
Use the motion profile values of the axis group as a whole, rather than those of the leading axis, without exceeding any of the defined axes motion VEL, ACC, DEC, JERK values. Not compatible with /2 switch. Range is 0-25 ms. |
/q |
Defines actual motor movement delay in microseconds. The delay resolution is 50 microseconds.The maximum delay is 100 controller cycles: 100ms for CTIME=1ms or 20ms for CTIME=0.2ms.Allows delaying actual motor movement start (RPOS) for the specified delay, while motion profile generation (APOS) starts immediately. |
/2 |
Use 20 kHz motion mode |
参数:
axis_list: 轴列表
Destination point:目标点
Value of Tf:Tf,期望Travel时间
Value of Vf:Vf,期望最后速度
Motion Delay: /q开关,运动开始前的延时时间
GPHASE
4阶段:
加速构建;加速完成,减速构建,减速完成
例子1,
BPTP 0, 100
移动轴0到位置100.
例子2,
BPTP/ed (0,1), 100, 200, 0.4
移动轴0,1,到位置100,200.不要执行下一个命令直到运动终止。这个运动必须在0.4秒中完成。
GMTYPE
增强运动BPTP的GMTYPE是11,如果使用20KHZ特征,创建运动时开关添加/2,就是43.
c)BPTPCALC
BPTPCALC函数重新计算运动参数VEL,ACC与JERK值
语法:
BPTPCALC real Motion_duration, real Distance, int index
参数:
Motion_duration |
The desired motion time in seconds. The time will be rounded up to a whole number of controller cycles. |
Distance |
The travel distance in user units |
Index |
1 - Velocity 2 - Acceleration 3 - Jerk |
例子,
! Calculate the motion parameter to execute a 10 unit BPTP motion in 3 ms
VEL(0) = bptpcalc(0.003, abs(10), 1)
ACC(0) = bptpcalc(0.003, abs(10), 2)
JERK(0) = bptpcalc(0.003, abs(10), 3)
enable(0)
BPTP/R(0), 10 ! Move axis 0, 10 units, in 3 ms
STOP
- Jog命令
Jog命令定义了Jog运动,没有目标结束点,以固定速度运行直到被下个运动命令终止,或错误发生。
语法:
JOG [/switch] axis_designator [,direction] [,velocity]
开关:
w |
Create the motion, but do not start until the GO command has been issued. |
v |
Use the velocity specified in the command instead of the default velocity. |
方向有+,-
例子1: Jog 0
例子2: JOG 0, +
例子3,指定速度:
JOG/v 0, 30000
例子4,
JOG 0, +
WAIT 500
JOG 0, -
例子5,
JOG (0,1,4), -++
- Track命令
Track命令发起一个轨迹跟踪运动。TPOS一直变化的话,运动就一直继续。
Track中断一般是下面原因:
1)子运动命令包含了轨迹运动
2)故障失能了驱动
3)HALT,KILL, DISABLE
语法:
TRACK [/switch] axis, [motor_motion_delay]
参数:
axis |
Axis designation, valid numbers are: 0, 1, 2, ... up to the number of axes in the system minus 1. |
motor_motion_delay |
(Optional, used only with /q switch) Delay, in milliseconds, before motor motion actually starts. |
开关:
/w |
Create the motion, but do not start until GO. |
/q |
Defines actual motor movement delay in microseconds. The delay resolution is 50 microseconds.The maximum delay is 100 controller cycles: 100ms for CTIME=1ms or 20ms for CTIME=0.2ms.Allows delaying actual motor movement start (RPOS) for the specified delay, while motion profile generation (APOS) starts immediately. |
例子1:创建0轴上的Track运动
TRACK 0 Create track motion of 0 axis
例子2:序列运动到1000,2000,10000,11000:
TRACK 2 Create track motion of axis 2
TPOS(2) = 1000 Move to point 1000
TILL ^AST(2).#MOVE Wait till the motion ends
TPOS2 = 2000 Move to point 2000
TILL ^AST(2).#MOVE Wait till the motion ends
TPOS2 = 10000 Move to point 10000
TILL ^AST(2).#MOVE Wait till the motion ends
TPOS2 = 11000 Move to point 11000
TILL ^AST(2).#MOVE Wait till the motion ends
HALT 2 Terminate track motion
上面的命令等价于,
PTP 2,1000 Move to point 1000
PTP 2,2000 Move to point 2000
PTP 2,10000 Move to point 10000
PTP 2,11000 Move to point 11000
Track运动的运动参数定义在ACSPL+的变量VEL,ACC,DEC和JERK中。
TRACK 1 Create track motion of axis 1
VEL(1) = 20000 Set motion velocity 20000 units/sec
TPOS(1) = 1000 Move to point 1000
TILL ^AST(1).#MOVE Wait till the motion ends
VEL1 = 5000 Set motion velocity 5000 units/sec
TPOS1 = 2000 Move to point 2000
TILL ^AST(1).#MOVE Wait till the motion ends
VEL1 = 10000 Set motion velocity 10000 units/sec
TPOS1 = 110000 Move to point 11000
TILL ^AST(1).#MOVE Wait till the motion ends
HALT 1 Terminate tracking motion
上面的例子中,应用程序更新TPOS在先前PTP运动结束后,下面的例子是在运动中更新TPOS:
TRACK 0 Create tracking motion of X axis
TPOS(0) = 2000 Move to point 2000
TILL GPHASE(0) >= 6 Wait till the motion comes to phase 6 (deceleration to final point)
TPOS(0) = 2500 Correct the final point
TILL ^AST(0).#MOVE Wait till the motion ends
HALT 0 Terminate tracking motion
在这种情况下,控制器并没有执行两个独立的运动。当TPOS改成2500,此时控制器还没有到达2000这个位置,控制器以飞行模式移动到2500.飞行模式切换是丝滑的。
同样的效果,可以用如下ACSPL+代码片段:
PTP 0, 2000 Move to point 2000
TILL GPHASE(0) >= 6 Wait till the motion comes to phase 6 (deceleration to final point)
BREAK 0 Terminate the current motion and provide smooth transition to the next motion
PTP 0,2500 Move to point 2500
例子1多轴:
TRACK 0;TRACK 2;TRACK 3 Create track motion of the 0, 2 and 3 axes
TPOS(0)=0; TPOS(2)=0; TPOS(3)=0 Move to point 0=0, 2=0, 3=0
TILL ^AST(0).#MOVE Wait till the motion ends
TPOS(2)=1000 Move to point 0=0, 2=1000, 3=0
TILL ^AST(0).#MOVE Wait until the 0 motion ends
TPOS(0)=100;TPOS(3)=200 Move to point 0=100, 2=1000, 3=200
HALT (0,2,3) Terminate track motion
下面的例子中TPOS更新了,而之前的运动还在进行中。
TRACK 0; TRACK 3 Create track motion of the 0 and 3 axes
TPOS(0)=2000; TPOS(2)=1000 Move to point 0=2000, 2=1000
TILL GPHASE(0) = 4 Wait until the motion reaches constant velocity (phase 4)
TPOS(3)=0 Set a new final point 0=2000, 3=0
TILL ^AST(0).#MOVE Wait until the motion ends
HALT 0 Terminate tracking motion
最后一个例子
TRACK 0; TRACK 2 Create track motion of the 0 and 2 axes
TPOS(0)=2000; TPOS(2)=1000 Move to point 0=2000, 2=1000
TILL GPHASE(0) = 4 Wait until the motion reaches constant velocity (phase 4)
TPOS(2)=0 Set a new final point 0=2000, 2=0
TILL ^AST(0).#MOVE Wait until the motion ends
HALT 0 Terminate tracking motion
- 分段运动
分段运动,能够沿着连续的路径移动,Path定义为平面上一连串的线性和弧的小段。尽管分段运动沿着平面路径移动的,但它可能包含多个轴,因为运动平面可以关联到任意映射变换的轴上。
1)理解从分段运动
分段运动可以分为两个部分:
a)计算路径
b)将路径分解到各自的轴中。
例子1:从轴跟从主轴的位置
S = MPOS
例子2:主轴 + 常数
S = MPOS + C
2)MSEG,LINE,ARC1,ARC2,STOPPER命令
这些命令是用来实现分段运动
语法:
MSEG [/switch] axis_group, initial_start_point [,initial_start_point, initial_start_point][,projection matrix_designator]
LINE [/switch] axis_group, final_point [,final_point, final_point]
ARC1 [/switch] axis_group, center_point, final_point, rotation_direction [,velocity]
ARC2 [/switch] axis_group, center_point, rotation_angle, rotation_direction [,velocity]
STOPPER axis_group
ENDS axis_group
开关:
w |
Create the motion, but do not start until the GO command |
v |
Use the velocity specified for each segment instead of the default velocity |
c |
Use the segment sequence as a cyclic array: after the last segment return to the first segment and so on. |
s |
Slaved motion - the motion advances in accordance to the master value of the leading axis (velocity lock). |
p |
Position lock - slaved motion, strictly conforming to the master value. |
e |
Extrapolated - if a master value travels beyond the specified path, the last or the first segment is extrapolated. |
t |
Stalled - if a master value travels beyond the specified path, the motion stalls at the last or first point. |
MSEG命令可以指定轴组和初始化起点:
MSEG(0,1), 1000, 1000
MSEG命令本身并不指定任何段,所以创建的运动并不马上启动。LINE或ARC命令必须跟在MSEG命令后面,来指定一个多段序列。
例子:
MSEG (0,1),1000,1000 Create segmented motion in group (0,1), coordinates of the initial point are (1000,1000).ARC1 (0,1), 1000,0,1000,-1000,- Add arc segment with center (1000,0), final point (1000,-1000), clockwise rotation.LINE (0,1),-1000,-1000 Add line segment with final point (-1000,-1000).ARC2 (0,1),-1000,0,-3.141529 Add arc segment with center (-1000,0) and rotation angle -p radians.LINE (0,1),1000,1000,50000 Add line segment with final point (1000,1000).ENDS (0,1) End the segment sequence
3)PROJECTION
PROJECTION命令是扩展MSEG..ENDS,允许三维分段运动。
语法:
PROJECTION axes, matrix_table
参数:
axes |
List of axes. |
matrix_table |
Coordinates defining the new plane. |
如果不指定矩阵表的话,对于2轴,就是如下2*2 matrix I2:
1 |
0 |
0 |
1 |
例子,
real M(3)(2) !Define Matrix
M(0)(0)=1;M(0)(1)=0
M(1)(0)=0;M(1)(1)=1
M(2)(0)=0;M(2)(1)=2.74 !Set the transformation
!matrix values.
VEL(0)=1000;ACC(0)=10000;DEC(0)=10000 !Axis motion parameters
ENABLE (0,4,5) !Required command.
GROUP (0,4,5) !Required command.
SET FPOS(0)=0;SET FPOS(4)=0;SET FPOS(5)=0 !Set axes’ FPOS=0
MSEG (0,4),0,0 !Define original plane.
PROJECTION (0,4,5),M !PROJECTION of the 0, 4 and 5
!axes by matrix M
ARC2 (0,4),750,0,6,24 !ARC2 performed on new plane.
ENDS (0,4) !Concludes MSEG.
STOP !End Program
4)表达式参数
LINE,ARC1,ARC2命令的参数可以是表达式,
real P, K, S Declare the real variables P, K and S.
P = 3.14159; K = 100 / P; S = P / 1000 Calculate P K and S.
PTP (0,1), -100, 0 Perform a point-to-point motion in the XY plane (X being the direction of the 0 axis and Y being
the direction of the 2 axis) to the point: (-100,0).
MSEG (0,1), -100, 0 Create a segmented motion.
LOOP 2000 Perform the loop 2000 times.
P = P + SLINE (0,1), P*K*cos(P), P*K*sin(P) Execute a linear segment based on a calculation.
END End loop.
ENDS (0,1) End segment motion.
5)STOPPER命令
STOPPER命令用来避免速度跳变的,损害驱动器
PTP (0,1), 1000, 1000 Go to initial point.
MSEG (0,1), 1000, 1000 Create a segmented motion.
LINE (0,1), 1000, -1000 Execute linear segment.
STOPPER (0,1) Slow down to zero.
LINE (0,1), -1000, -1000 Execute linear segment.
STOPPER (0,1) Slow down to zero.
LINE (0,1), -1000, 1000 Execute linear segment.
STOPPER (0,1) Slow down to zero.
LINE (0,1), 1000, 1000 Execute linear segment.
ENDS (0,1) End the segment sequence.
上面的程序完成了矩阵路径规划,加入了STOPPER,消除了速度跳变
6)周期运动
命令开关/c提供了分段运动的周期性执行。MSEG/c 命令创建了一个循环执行的多段运动。
ENABLE (0,1)
MSEG/c (0,1),1000,1000 !Create segmented motion in group X, coordinates of
!the initial point are (1000,1000)
ARC1(0,1), 1000,0,1000,–1000,– !Add arc segment with center (1000,0), and
!final point (1000,-1000), clockwise rotation
LINE (0,1),–1000,–1000 !Add line segment with final point (-1000,- 1000)
ARC2 (0,1),–1000,0,–3.141529 !Add arc segment with center (-1000,0) and !a rotation angle of -pLINE (0,1),1000,1000 !Add line segment with final point (1000,1000)ENDS (0,1) !End the segment sequence
7)极值点的从运动
根据运动开关,比如/c是重复运动
- 扩展分段运动
- 混合分段运动
- 两轴例子
- 主从运动
- 路径Path命令
- 样条运动
- 多轴点到点运动
- 光滑曲线路径
- NURBS
- 开环操作(扭矩控制)
- 步长速度规划
- 局部坐标系统