Difference between revisions of "Multi-Axis Kinematics/zh-hans"
Line 125: | Line 125: | ||
== 运动元素 == | == 运动元素 == | ||
− | + | softMC是一个多轴和多组系统。在许多方面,组和轴是相同的。例如,它们都具有以下属性: '''AMAX''', '''VMAX''', '''VCRUISE'''。另一个相同的方面是两者的运动。虽然运动命令有仅组('''CIRCLE''', '''MOVES''') 或仅轴('''JOG'''),但单独移动轴时,不可能移动包含相同轴的组,反之亦然。轴在组中有效。 '''ATTACH'''''''DETACH'''的工作方式相同,当轴的组已经关联时,轴不能再关联。 因此,我们可以使用一个术语'''motion-element'''来表示轴和组。 | |
− | + | 有一些是仅属于轴或仅属于组的属性。例如'''DRIVEADDRESS'''是一个仅属于轴的属性。 | |
− | '''MOVE''' | + | '''MOVE'''包含两种不同的命令特性,Move-Group和Move-Axis。Move-Group将全部组一起移动。组内的所有轴在同一时间开始和结束运动。Move-Group保持在组和轴的运动学限制 |
+ | ('''VELOCITY''','''ACCELERATION''','''JERK''')。组的限制被执行并施加组运动上(集合,空间XY,XYZ)。轴限制仅与轴运动与整个组运动的比例成比例的执行。如果轴X向Y轴一半移动,则只能使用一半的极限值。运动的总时间是最慢轴完成运动所需的时间。这里,最慢的轴是具有最大路径/速度比的轴,并且不需要具有最小最大速度的轴(因为如果这样的轴没有运动,则不是最慢的轴)。另一方面,Move-Axis仅检查指定轴的极限,并且与使用该轴的任何组的极限无关。 | ||
− | + | 分析器的准备可以额外减少运动参数。这是典型的短暂的运动,由于'''ACCELERATION'''和'''JERK'''的现有限制,给定的巡航速度无法达到。 | |
− | == | + | == 关节 == |
Joints are virtual axes. Joints give the illusion of only one axis, both from the language point of view and looking at the physical movement of the coupled axis. The joint is analogous to an axis. Joints are denoted as J1, J2, etc. | Joints are virtual axes. Joints give the illusion of only one axis, both from the language point of view and looking at the physical movement of the coupled axis. The joint is analogous to an axis. Joints are denoted as J1, J2, etc. | ||
Revision as of 05:45, 17 May 2017
语言: | [[::Multi-Axis Kinematics|English]] • [[::Multi-Axis Kinematics/zh-hans|中文(简体)]] |
---|
Contents
- 1 介绍
- 2 耦合
- 3 Points
- 4 Refer to
介绍
多个轴可以组合并移动。 有:
- 简单组((无模型,可以是相同类型或不同类型)
- 笛卡尔组(每个轴的作用被严格定义,例如:XYZ,XYZR,...)
- 机器人(应用特定机器人模型(SCARA,PUMA,...)
组是数据对象(运动元素),使我们能够将其轴同步移动。如果所有的轴都是相同类型(全部是线性轴或全部旋转轴),它们的速度,加速度和加加速度值可以组合起来(使用平方和的平方根),运动参数将具有物理意义。 我们称这些类型的组为homogeneous groups。
Non-homogeneous groups由旋转轴和线性轴两种轴组成。增加了一个特征来支持非同类型组速度的定义。 在设置中,声明旋转轴和线性轴。 系统确定它是线性还是旋转主导组。例如,在SCARA机器人中,有两个旋转轴用于第一和第二个关节,另一个旋转轴用于最后一个关节(旋转)。 只有一个线性轴(Z轴)。这种系统是旋转主导的。 另一个例子是XYZ-Roll系统。 这里,只有一个旋转轴(旋转)有两个线性(X和Y)轴和另一个线性(Z轴)。 在这种情况下,系统是线性主导的。 轴设置定义组的行为。每个轴必须声明是线性轴或旋转轴,通过设置 POSITIONROLLOVERENABLE 为线性轴(0)或旋转轴(1)。
在非同类型组中, 根据组的主导类型(参考: DOMINANCEMODE)总是给出联合插补运动(MOVE)命令速度。如果该组是线性优势的,速度(VCRUISE, VFINAL)为线性单位(mm / sec)。 在运动的准备阶段检查其他非线性轴。 这些轴的速度不能超过最大值。 如果是这样,总体(组)速度就会降低。
这个规则只有一个例外。这是当一个组运动只发出一个运动轴并且其他轴停止时。然后,给定速度的单位直接取决于该轴的单位。 例如,SCARA机器人的第三轴上具有运动,速度值以mm / sec为单位。
对于组内插补运动的加速度和加加速度值也是如此。
如果非同类型组中的设置不正确,即有不同类型的轴但是但所有轴的POSITIONROLLOVERENABLE都设置为相同的值。运动组仍然会运动,但是组中速度/加速度/加加速度值将不再具有物理意义。如果轴之间的数值显着不同,则系统可能有线。?
NOTE | |
上述讨论仅适用于组的简单联合插值运动(请参阅Move or Circle)。 笛卡尔组中Moves和Circle使用Vtran和Vrot参数。 |
坐标系
世界坐标系
具有不同的世界和关节坐标使机器人运动学独一无二 。世界坐标通常被认为是应用程序的工作坐标。通常基于机器人基座的笛卡尔坐标系有一些其他的形式。
另外一种是在终端执行器(比如夹爪等)的方向添加另一组坐标。刚体在空间中的方位通常用三个角度描述。根据自由度的数量(电机用来驱动关节角度),它们可能不相等。在大多数情况下,世界空间坐标由其位置部分(X,XY或XYZ元组)给出。 一般来说,它可以是从球坐标到圆柱坐标的任何东西。 方向组件可以使用许多形式来描述方向。大多数使用的方向角坐标系是欧拉角:偏航,俯仰和滚转。理论上,欧拉角有12种不同的表现形式,根据大多数机器人模型中使用Z-Y-Z顺序的方向顺序。
关节坐标系
机器人的关节空间是一个相对简单的概念。关节坐标是唯一描述机器人相对于先前的位置的数字。 如果连接节段的关节是旋转的,则关节坐标为旋转角度。 如果是线性的,则关节坐标是线性位移(毫米)。
点数据类型
关节坐标的概念是一个n元组数。 每个数字表示特定关节的坐标。 世界坐标由描述每个不同世界空间表示的不同内置类型(XY,XYZ,XYZR)支持。 对于相同(或相同维度)的世界坐标,可以有不同的世界空间描述。 每个机器人都有其默认的世界空间类型。 不同的机器人可以具有相同的世界空间类型,只要它们具有相同数量的自由度(NDOF)。 例如,xy平台世界空间具有XY世界空间描述符。SCARA机器人有用于垂直运动的Z轴和用于定向的转动轴,使用由由X,Y,Z和转动或XYZR描述组成的世界坐标系。
不同的坐标系被实现为不同数据类型的变量。 通常,坐标系中的一个点被定义为点数据类型。 根据是否是关节空间或世界空间,点的子类型不同。 点数据类型有两个子类型: JOINT和LOCATION。两者都有一个世界空间描述符,可以区分相同的子类型。 世界空间坐标存储在变量中,定义为:
DIM A AS LOCATION OF XYZR
关节空间是:
DIM A AS JOINT OF XYZR
具有两个子类型(LOCATION和JOINT)和世界空间描述符(XY,XYZ,XYZR等)的点数据类型涵盖了所有可能的机器人空间变化。这些变量与机器人无关,可以在系统中未定义机器人的情况下使用。当它们与机器人或组的连接使用时,世界子类型必须相等。
该点可以使用所有可用的算术运算(+ - * /)作为数值数据类型进行操作。 操作被定义为逐个坐标操作。只有相同子类型和相同世界空间的点可以组合。
用于点常数的语法: 用方括号({})内的命令分隔的值列表表示点。 如果它之前是井号(#),它是一个位置:
DIM C AS LOCATION OF XYZR C = #{0,0,0,0} DIM I AS JOINT OF XYZR I = {0,0,0,0}
用户单位
softMC可以让您自由地更改和选择不同的单位。机器人模型具有较小的灵活性。由于关节和世界空间之间的紧密关系,您必须以毫米或度数定义关节位置单位,以秒为单位定义所有时间单位,以便世界空间和关节间隔都是兼容单位。世界空间的单位自动设置为毫米-度-秒。
每个轴都有四个缩放因子: PFAC,VFAC, AFAC, and JFAC。这些将编码器计数和旋转计数转换为用户位置单位(英寸,毫米或圈)。它们还指定在位置求导中使用什么时间单位(VEL, ACC, JERK)。由于位置因子定义了计数和用户位置单位之间的比例,其余因子定义了毫秒和用户时间单位之间的比率。 通常有:
<axis>.pfac = <number of counts per user position units> <axis>.vfac = pfac/1000 (if in seconds) <axis>.afac = vfac/1000 (if in seconds) <axis>.jfac = afac/1000 (if in seconds)
所有轴都设置完毕后,组包含这些轴。 所有轴上必须具有相同的用户单位。 设置组缩放因子 组没有位置因子! 相反, 使用每个轴的 PFAC。
MOVE g1 {1,2,3} vcruise = 10
目标坐标被给予每个轴,并且转换成使用每个轴的PFAC编码器/解析器计数。 VCRUISE与任何轴无关。 使用组因子, VFAC, AFAC和JFAC。 组速度以用户单位/秒表示。
要使系统单元正常工作, 请将每个轴的单位因子 (PFAC, VFAC, AFAC and JFAC)设置为毫米-度-秒并将组单位设置为秒:
<group>.vfac = 1/1000 <group>.afac = vfac/1000 <group>.jfac = afac/1000
耦合
在许多机器人应用中,机械结构引入轴之间的机械耦合。在这种情况下,两个或多个电机只移动一个关节。 因此,仅激活一个电机会导致两个轴(关节)的运动。有很多这样的机械设置的例子。通常当电机移动关节时,它们正在启动。 当电动移动第二关节置于第一关节之前时,第二关节通过第一和第二电机的运动而移动。这种应用的典型实例是移动机械手臂(PUMA)的电机通过链条或皮带移动机器人手臂。最后一个机器人部件上的差速齿轮传动从末端执行器移动最后一个电机(转动),第五和第六个电机在第六个和第六个电机上引入运动(Staubli RX系列)。
Staubli RX 手腕 – 对轴 a5 ,a6:
j6.pcmd = a6.pcmd – a5.pcmd
BOSCH – SCARA – 对轴 a3,a4:
j3.pcmd = a3.pcmd + 18.3*a4.pcmd.
PUMA – a2,a3 and a4:
j4.pcmd=a2.pcmd+a3.pcmd+a4.pcmd.
缩放和旋转:
j1 = 707.1*a1.pcmd + 707.1*a2.pcmd j2 = 707.1*a1.pcmd + 707.1*a2.pcmd
正交校正:
j1 =10000*a1.pcmd j2 = 2.91*a1.pcmd + 10000*a2.pcmd
组关节是softMC固件的标准配置,涵盖上面给出的耦合示例。
运动元素
softMC是一个多轴和多组系统。在许多方面,组和轴是相同的。例如,它们都具有以下属性: AMAX', VMAX, VCRUISE。另一个相同的方面是两者的运动。虽然运动命令有仅组(CIRCLE, MOVES) 或仅轴(JOG),但单独移动轴时,不可能移动包含相同轴的组,反之亦然。轴在组中有效。 ATTACH''DETACH的工作方式相同,当轴的组已经关联时,轴不能再关联。 因此,我们可以使用一个术语motion-element来表示轴和组。
有一些是仅属于轴或仅属于组的属性。例如DRIVEADDRESS是一个仅属于轴的属性。
MOVE包含两种不同的命令特性,Move-Group和Move-Axis。Move-Group将全部组一起移动。组内的所有轴在同一时间开始和结束运动。Move-Group保持在组和轴的运动学限制 (VELOCITY,ACCELERATION,JERK)。组的限制被执行并施加组运动上(集合,空间XY,XYZ)。轴限制仅与轴运动与整个组运动的比例成比例的执行。如果轴X向Y轴一半移动,则只能使用一半的极限值。运动的总时间是最慢轴完成运动所需的时间。这里,最慢的轴是具有最大路径/速度比的轴,并且不需要具有最小最大速度的轴(因为如果这样的轴没有运动,则不是最慢的轴)。另一方面,Move-Axis仅检查指定轴的极限,并且与使用该轴的任何组的极限无关。
分析器的准备可以额外减少运动参数。这是典型的短暂的运动,由于ACCELERATION和JERK的现有限制,给定的巡航速度无法达到。
关节
Joints are virtual axes. Joints give the illusion of only one axis, both from the language point of view and looking at the physical movement of the coupled axis. The joint is analogous to an axis. Joints are denoted as J1, J2, etc.
Each joint actually represents one or several axes of the group, according to the given coupling matrix. If the group has no coupling matrix defined, the joint is a direct representation of the axis of the same ordinal number in the group as the joint index. To introduce another term, the "shadow-axis" of a joint is the axis with the same ordinal number in the group as the joint index. For example, if a group consists of axes A2, A3, A4, the shadow-axis of the joint J1 is A2.
Normally, all joint properties are a direct representation (have the same value) of shadow-axis properties, independent of whether the coupling matrix is defined or not. The only exceptions are properties related to joint position: PCMD, PFB, VCMD, VFB, CCMD, CFB, PMAX, and PMIN. These are unique for each joint.
Current positions and velocities are obtained according to the given coupling matrix. They are computed each time a query of these values is issued (PCMD, PFB, etc.). They are read-only and do not represent any specific internal variable. Symmetrically the same properties, when queried from a group (?g1.PCMD), return lists of joint-property values according to the coupling matrix. The movement’s target positions (MOVE or CIRCLE) of group movements are treated analogously (coupling matrix).
On the other hand, the joint’s position limits (PMAX and PMIN) are added to the joints. The position limit of the joint and the position limit of the shadow-axis are not related, but independent of whether the coupling matrix is defined or not. The joint position limits are always used when the coupling matrix is defined (COUPLED = 1). In this case, the shadow-axis limits are not used. This is only true for joint and group movements. Single-axis movement (e.g., MOVE A1 100) is limited only by the axis limits, independent of coupling.
Joints represent several axes of a group. Joint movements are actually group movements:
Move-Group = Move-Joint
Joint movement gives the illusion of moving one physical axis (MOVE J1 100), although several motors could be moving together. The movement is executed according to the specified joint’s movement parameters. For example:
A1.Acc = 100 MOVE A1 50
Is analogous to:
J1.Acc = 100 MOVE J1 50
Move-Joint simulates the behavior of moving a single axis by moving a single joint both by the parameters and physical motion. The only difference is that several motors are moving instead of just one. When moving joints, all motor limits within each group axis are checked. The joint movement is a group movement of one joint-coordinate with the group motion parameters copied from the shadow-axis. The following translation rule is true:
MOVE J1 10 <=> MOVE {10,0,0,0} abs = J1.abs vcruise = J1.vcruise acc = J1.acc
Robot Models
A robot is defined as a group with a special model type. (See the list of currently available robot models: robot_model_table)
For example:
COMMON SHARED scara AS GROUP AxNm = a1 AxNm = a2 AxNm = a3 AxNm = a4 Model = '''4'''
Robot Setup
This automatically defines a robot with a SCARA kinematics model. Contrary to the regular groups that need only the axis to be enabled, you must set the robot parameters and configure them. The robot parameters needing to be set differ from robot to robot. For the SCARA robot, these are:
- Set all axes with all standard kinematics parameters.
- Define the roll-over properties.
- Set all user-units factors for the entire group: VFAC, AFAC, JFAC
- Set segment lengths and joints orientations for each robotic link.
- Set kinematics of regular groups (VELOCITY, ACCELERATION, JERK, etc.)
- Set kinematics of Cartesian motions (VTRAN,VROT, etc.)
- Issue CONFIGGROUP
Only after setting all these and successfully executing CONFIGGROUP can the robot be moved. Otherwise, an error is returned, stating that the group is not configured. The important difference between the regular groups (those with default model value 1) and the robot, is the necessity of executing CONFIGGROUP. In robot groups, no motion is allowed before the robot is configured.
Model value automatically defines the default robot world space descriptor. For model 4 (SCARA), the XYZR (x-y-z-roll) world-space is selected.
In groups with the robot model defined (model > 1), the translation between joint- and world-space is not simple. Translating joint coordinates into world coordinates is accomplished with TOCART taking both the robot and given joint coordinates (position variable) as input arguments. The output of this are world coordinates corresponding to the given joint position.
The other direction is more complex. It is accomplished with TOJOINT receiving three input arguments: the robot, the given Cartesian point, and the configuration flag.
The configuration flag is used to select between the two translation functions. In most robot models, there is more than one joint coordinate description for the same world-space position. The different robot configurations can produce the same world-space positions with different joint-space values. The robot configurations differ from robot to robot. In SCARA, there are only two configurations: lefty (second joint coordinate is negative) and righty (second joint coordinate is positive).
Interpolation
For groups with robot models (model > 1), there is an additional moving type: MOVES. The movement makes a straight path from the starting position to the given target position in the world space. The straightness is tightly-related to the working space. The same path can be straight in the Cartesian working space (XYZ) but curvy in joint space, and vice versa. MOVES is used solely for groups from type robot and cannot be used in regular groups.
Straight line motion refers to motions that are straight lines in world-space. In groups with no robot model (model=1), all motions produced with MOVES are straight-line motions in joint-space. In regular linearly-dominant groups, most of their axes are linear. As the world-space and joint-space are identical, MOVES executes a straight line in both joint- and world-space. The target position can be given both in world- and joint-space coordinates. The movement differs from joint interpolation (MOVE). Instead of joint-space kinematics parameters used in regular groups, the world-space parameters for velocity, acceleration and jerk are used. These parameters are available in two forms:, one for the translational part of the motion and one for the rotational part (orientation).
When world-space has both position and orientation components, the straight-line motion includes interpolation on both position and orientation. Because these two are intrinsically different objects, two different parameters are needed: one for the translation (pure position interpolation): VELOCITYTRANS, ACCELERATIONTRANS, JERKTRANS; and one for the orientation (rotation interpolation): VELOCITYROT, ACCLERATIONROT, JERKROT. These parameter are used only for Cartesian interpolation (MOVES and CIRCLE). These parameters have no influence on joint interpolated motion (MOVE) because it is not a world-space interpolation.
The two sets of parameters define the straight line motion. Which parameter is dominant for the motion depends on the movement. If most of the movement is in translational position change and the orientation change is much smaller, the translational part is taken. Conversely, the rotational parameters define the movement.
There are four commands to make point-to-point movement in robot groups. There are two commands to interpolate the motion (MOVE and MOVES) and two commands to define the target point (JOINT and LOCATION). The total combination of these gives four options.
LOCATION target | JOINT target | |
Cartesian-Interpolation | MOVES #{400,400,0,0} | MOVES {45,45,0,0} |
Joint-Interpolation | MOVE #{400,400,0,0} | MOVE {45,45,0,0} |
Contouring
Contouring connects different motions by defining the final velocity for each movement. This way, the motion does not stop at the segment. It is continued with the next motion. This method is applicable in one-axis applications, but has several drawbacks that become more prominent in multi-axis applications:
- The angle between the movements' direction must be zero. Otherwise, a jump in velocity occurs.
- It is not possible to connect arc with linear segments without a jump in acceleration.
- You must calculate the achievable final velocities on each segment to stop after the last segment.
Working Envelope
Robot working space is determined by the position limits of each joint. The working space (all reachable positions) is limited by the working envelope of the robot. From the outer side, it is limited by the arc made rotating the first joint with a fully stretched arm (j2.pcmd=0). This is the maximum radius of reachable points (RMAX). It is an internal value computed each time the robot is configured (CONFIGGROUP). Points given outside this radius are rejected with the error message, Point Too Far.
The other limit is the small circle with the radius (RMIN). This circle is obtained by rotating the first joint with a maximally-folded second joint (not more then 180 degrees). This radius is additionally enlarged by the robot's base size and the attached end-effector mechanism to prevent the robot from colliding with itself. The minimal working envelope radius (RMIN) is available to the user (contrary to RMAX). It is recommended that this value be set for each application according to the physical setup of the robot. If a point is given inside RMIN, an error message is returned. For example:
Program attach move {j1.pmin,j2.pmin,0,0} while ismoving sleep 1 End While Print "Plotting the workspace" move {j1.pmin,0,0,0} move {j1.pmax,0,0,0} move {j1.pmax,j2.pmax,0,0} detach End Program
Robot Configurations
In robot models, there are several joint points representing the same robot end-effector position for each location point. To uniquely select between different joint coordinates, there are configuration flags.
For SCARA kinematics, there is only one configuration flag available: the arm flag. It indicates either lefty (1) (j2.pcmd > 0) or righty (2) (j2.pcmd > 0). A value of 1 (lefty) means that the joint coordinates having a positive second joint are taken to represent the given location. The current configuration of the robot is returned by ARMFBK. The value can be 1 or 2, depending on the position feedback value of the second joint. ARMFBK determines the movement's target position. It can be automatic (0), lefty(1) or righty(2). When a movement with a Cartesian target position is given, the joint coordinates of the target position are selected according to ARMFBK. If it is zero (automatic), the current robot configuration is used (ARMFBK).
PUMA models traditionally use three configuration flags (arm,elbow and wrist – ACMD, ECMD, WCMD).
Another use of configuration flags is in the conversion function, TOJOINT. This function translates the given location point into joint point. It receives two arguments. The first is the location variable and the second is the configuration flag.
Points
A point is a data type used for storing a list of doubles in a variable. The main advantage of points is that you can directly call the whole vector without having to access every element of it. There are two subt-ypes of the point data type: LOCATION and JOINT. Using both point types in the same expression results in a type mismatch translation error. Type casting between point types requires the usage of special system functions TOJOINT and TOCART.
Declaration
A point must be declared before you can use it. The declaration of points is defined according to the type of robot (XYZR, XYZ, etc.). The softMC enables the declaration of point variables, which can be scalar or arrays. Point arrays may have up to 10 dimensions. Point variables are designed to hold a list of 2 to 10 double-type coordinates. A point variable is declared in relation to a robot type. Therefore, declaring a point variable must include the name of a valid robot type. The dimension of the point is the same as the dimension of the type of robot. The syntax is:
(COMMON SHARED|DIM {SHARED}) <variable_name> AS JOINT OF <robot_type>(COMMON SHARED|DIM {SHARED}) <variable_name> AS LOCATION OF <robot_type>
<robot_type> can be:
XYZR – Three cartesian axes + rollXY – two axes XY tableXYZ – three axes XYZ system
For example:
Common Shared JointXYZ As Joint Of XYZ Common Shared JointXYZR As Joint Of XYZR Common Shared LocXYZ As Location Of XYZ JointXYZ = LocXYZ --> Error – type mismatch
Variables
Two new variable types are defined for point variables in the translator: LOCATION and JOINT. For the translator, a point variable differs from any other type of variable (Long, Double, etc.) only by its type. A point variable is inserted to the expression tree as a variable leaf. The variable leaf retains data related to the point variable, including its context (system, program or local), its offset (taken from the symbol table), and its type (LOCATION or JOINT, also taken from the symbol table).
Declaration
When declaring a point variable, data corresponding to this variable is entered into the correct symbol table (depending on whether it is a system variable, a program variable, or a local variable). A point variable is defined in the symbol table by its name, its type (LOCATION or JOINT) and an offset of the data segment. Each offset of the data segment corresponds to the address of the point variable. The robot type string is sent to a special function that gives the robot-type value and the number of coordinates.
Constant Points
Constant points are location or joint vectors with an undefined robot type. The constant point’s subtype is defined by the shape of its brackets (#{ } for location, { } for joint). In the translator, each of these two vector types is considered an expression. Each expression-related command and manipulation (such as print commands, mathematical operators, etc.) can be applied for the joint and location vectors.
While executing a vector expression, each vector element is pushed separately into the stack as a double type expression (by executing the left side of the JOINT or LOCATION node). Long type vector elements are converted to double type expressions (in the coordinate node) after the execution of the expression at the right side of each coordinate node).
Execution of the right side of the JOINT or LOCATION node results in pushing the number of the vector elements into the stack (as a long type constant). The point’s subtype (determined by the shape of the vector’s brackets) is pushed to the stack (as a long type constant) by executing the third side of the JOINT/LOCATION node.
Vectors
Vectors are actually constant points, at which a list of 2 to 10 coordinates is written between curly brackets {}. In location vectors, the curly brackets are preceded by the # sign. A coordinate can be any type of expression (constant, variable, mathematical expression, function call, etc.) of long or double type. Long type coordinates are automatically converted to doubles. Unlike point variables, vectors are not related to robot types, and characterized merely by their size (number of coordinates).
{<expression_1>, …, <expression_n>} ‘ Joint vector
#{<expression_1>, …, <expression_n>} ‘ Location vector
Point variables and vectors appearing in the same expression must match in type (joint or location) and size.
Common Shared JointXYZ As Joint Of XYZ JointXYZ = #{1.5, 2.8, 3} --> Error – type mismatch PRINT {20, 6.7, 23} + #{8.43, 2, 0} --> Error – type mismatch JointXYZ = {2, 6} --> Error – size mismatch PRINT {20, 6.7, 23} - {5, 4, 22.9, 31} --> Error – size mismatch
Properties
Some group properties are points. There are several read-only properties of joint- (VELOCITYFEEDBACK, POSITIONCOMMAND, DEST_JOINT), and location-type (DEST, HERE, SETPOINT). There are also some location-type read-write properties, like TOOL, BASE, etc.
As in point variables, the robot type also characterizes point properties.Point properties appearing in expressions in a mixture with other points must match in type and robot type to point properties and variables, or in type and size to vectors.
Common Shared SCARA As Group Axnm = A1 Axnm = A2 Axnm = A3 Axnm = A4 Model = 4 Common Shared PointXYZR As Joint Of XYZR Dim Shared PointXYZ As Joint Of XYZ PointXYZR = SCARA.SetPoint --> Error – type mismatch (Setpoint returns a location) PointXYZ = SCARA.VelocityFeedback --> Error – robot type mismatch SCARA.Base = #{56.5, -104.7, -90.5} --> Error – size mismatch
Point Dimension
You do not define the size of the vector data type at the declaration of it, but you define the type of robot related to the point. This gives the point a dimension.
Point Assignment
Point assignment uses the following syntax:
<variable_name> = (<expr1>,<expr2>,<expr3>,…,<exprn>)() = #{} for location() = {} for joint
The expression can be a constant or other vector variable of the same robot type, but the size of the right side of the expression must equal the left side. If you try to assign a point with a point of other robot type, an error is received.
Single Coordinate Point Assignment
The syntax for assigning a single coordinate of a point is:
<variable_name>{<expression>} = <expression>
Point Query
The syntax for querying a point is:
?<variable_name>
Single Coordinate Point Query
The syntax for querying a single coordinate of a point:
?<variable_name>{<expression>}
Example 1
Common shared P1 as location of XYZR 'declaration of a vector (global) P1 = #{1,2,3,4} 'assign the whole vector P1 = #{1,2} 'return a translation error ?P1 'read the whole vector ?P1{2} 'read the second coordinate of the vector
Example 2
Common shared P2[5] as location XYZ 'declare a global array of vectors P2[1] = #{1,2,3} 'assign the whole vector P2[2] = #{5,2} 'return a translation error ?P2[1] 'read the whole vector ?P2[2]{2} 'read the second value of the vector
Operators
Like any other data type, you can use operators for points. The system only defines the equal operator (plus, minus, multiplication and division). Operations between points can only be performed between points of the same type and robot type (or size). All operations can also be performed between points and long or double type expressions.
Assignment
Point variables and read-write properties can be assigned by point variables, vectors and point properties compatible in type and size (or robot type).
Query
Point variables, properties and vectors return a value, so they can all be queried through printing or assignment into a compatible point variable or read-write property.
Common Shared SCARA As Group Axnm = A1 Axnm = A2 Axnm = A3 Axnm = A4 Model = 4 Common Shared PointVar1 As Joint Of XYZR Dim Shared PointVar2 As Joint Of XYZ Dim PointArr[4] As Joint Of XYZR PointVar1 = PointArr[2] PointVar2 = {23.4, 60, 42} PointArr[1] = SCARA.PositionCommand SCARA.Tool = #{10, 20,30, 0} PRINT PointVar2, SCARA.Tool, {100.3, 20} --> {23.4 , 60 , 42} #{10 , 20 , 30 , 0} {100.3 , 20}
Plus
The point plus operator is used like any other data type. It adds each element of the first point with each element of the second point. The result is a point.
?{1,2}+{2,4} --> {3,6}
Minus
The point minus operator is used like any other data type. It subtracts each element of the first point with each element of the second point. The result is a point.
?{1,2}-{2,4} --> {-1,-2}
Multiplication
The point multiplication operator is used like any other data type. It multiplies each element of the first point with a number. You can only multiply a point with a single number (one-dimensional number). The result is a point.
?2*{2,4} --> {4,8}
Division
The point division operator is used like any other data type. It divides each element of the first point with a number. You can only divide a point with a single number (one-dimensional number). The result is a point.
?{2,4}/2 --> {1,2} ?2/{2,4} --> {1,0,5}
Compound (:)
Is an operator specific for points, which should be operated between two locations of the same size (or robot type).
? #{-56.5 , -104.7 , 89.5} : #{ 0.0, -104.7 , -0.5} --> #{-56.5 , -209.4 , 89}
Limitations
MOD (modulus), ^ (power), logic and bitwise operators cannot be used for points.
Points cannot be used as condition in flow control statements and event definitions.
Points cannot be recorded.
Points in Functions
Point variables can be passed to functions and subroutines both by reference and by value. An entire array of points can also be passed (by reference) to a function or subroutine. On the other hand, point properties and vectors can only be passed by value. Points can also serve as return values of functions. However, the point type and size (or robot type) of an argument or a return value must match function declaration.
Passing By Value And Reference
A point can be passed by value and by reference like any other data type. For example:
Program Dim p1 as joint of XYZR Call Sub1(P1) ?p1 End program Sub Sub1(X as joint of XYZR) X = {1,2,3,4} End Sub
This program assigns P1 to {1, 2, 3, 4} and prints {1, 2, 3, 4} as output. When a point is passed by reference or value, you can only pass a point of the same robot type to X. Otherwise, you receive a translation error.
Example 1
Program Dim p1 as location of XYZR Call Sub1(P1 --> TRANSLATION ERROR !!! ?p1 End program Sub Sub1(X as location of XYZ) X = #{1,2,3,4} End Sub
Example 2
Program Dim p1 as joint of XYZR Call Sub1(P1) --> TRANSLATION ERROR !!! ?p1 End program Sub Sub1 (ByVal X as joint of XYZ) X = {1,2,3,4} End Sub
Returning Point From Function
A function can return a point variable like any other data type. For example:
Dim A as location of XYZR Program Move G1 MyFunc(1) vcruise=299 --> this will be OK if G1 is of XYZR robot type. End Program Function MyFunc(i1 as long) as location of XYZR MyFunc = #{1,2,3,4} End Function
Motion Commands
Some motion commands use point nodal parameters when applied on groups. For example: CIRCLE, MOVE and MOVES.
Some nodal parameters can be assigned with both point types (LOCATION and JOINT), like CIRCLECENTER, CIRCLEPOINT and the target positions of MOVE and MOVES. Other nodal parameters can accept only location points, like TOOL, BASE, etc. Assign all nodal parameters with points compatible in robot type or size to the group.
Common Shared SCARA As Group Axnm = A1 Axnm = A2 Axnm = A3 Axnm = A4 Model = 4 Common Shared JointXYZ As Joint Of XYZ MOVE SCARA JointXYZ --> Error – robot type mismatch CIRCLE SCARA Angle = 180 CircleCenter = #{350, 500, -80} --> Error – size mismatch MOVES SCARA #{-22, 503.8, -8.3, 149} Base = SCARA.Dest_Joint --> Error – type mismatch
Point As An Expression
Points properties can be stored as a point or can be compared as a point. For example:
Dim A as Joint of XYZR A = {1,2,3,4} A = G1.Pcmd A = G2.Pcmd --> returns a translation error if G2 is not of XYZR type.
Functions
The following functions are defined:
<XYZR location> = TOCart (<group>, <XYZR JOINT>) <XYZR Joint> = ToJoint(<group>,<XYZR LOCATION>,<configuration-flag:integer>) <double> distl(<location>,<location>) Distance between points (length). <double> distr(<location>,<location>) Distance between points (angle).
Where for TOJOINT instruction the number and type of configuration flags depend on each robot type. Note that robot properties ARMCMD, ECMD, WCMD have all three values(0,1,2) where 0 is reserved for AUTO option. The configuration bits however have only two values (0,1).
for SCARA robot : Arm ( Bit 0): value = 0 - Lefty(armcd = 1)value = 1- Righty(armcmd = 2)
for PUMA robot : Arm ( Bit 0): value = 0 - Lefty(armcd = 1) value = 1 - Righty(armcmd = 2)
Elbow ( Bit 1):value = 0 - Below(ecmd = 1) value = 1 - Above(ecmd = 2)
Wrist ( Bit 2): value = 0 - Noflip (wcmd = 1) value = 1 - Flip (wcmd = 2)
for TRAVERSE-ARM robot: Arm ( Bit 0): value = 0 - Lefty(armcd = 1)value = 1 - Righty(armcmd = 2)
for DELTA, SCISSORS, … and other robots that have no configuration flags these fields are not used.
The configuration flag argument of the tojoint is defined as:
SAVE/LOAD
Each global variable can be stored in a file. The variable and its value are stored in same syntax as it is defined in the program. You can select a data-type to be stored. If a data-type is selected, the SAVE command stores only global variables of that data type. If file with same name already exist its extension is renamed to *.bak and new file is created. Loading the file overwrites the values of the saved global variables. You can save all the points related to some type of robot. For example:
SAVE file = "Myfile.prg" type = location robottype = xyzr SAVE file = "Myfile.prg" type = all LOAD Myfile.prg