没有合适的资源?快使用搜索试试~ 我知道了~
首页UR机器人脚本手册 SW5.10 版
UR机器人脚本手册 SW5.10 版
需积分: 50 26 下载量 67 浏览量
更新于2023-04-28
收藏 764KB PDF 举报
The URScript Programming Language G5 脚本文件_scriptManual_SW5.10_en UR机器人 官方脚本文件 2021年更新比较详细 相对中文版比较内容丰富
资源详情
资源推荐
4.Matrix and Array Expressions
Matrix and array operations can be assigned to a variable to store and manipulate multiple numbers at
the same time. It is also possible to get access and write to a single entry of the matrix. The matrix and
array are 0-indexed.
array = [1,2,3,4,5]
a = array[0]
array[2] = 10
matrix = [[1,2],[3,4],[5,6]]
b = matrix[0,0]
matrix[2,1] = 20
Matrix and array can bemanipulated bymatrix-matrix, array-array,matrix-array,matrixscalar and array-
scalar operations.
Matrix-matrix multiplication operations are supported if the first matrix’s number of columns matches
the second matrix’s number of rows. The resulting matrix will have the dimensions of the first matrix
number of rows and the second matrix number of columns.
C = [[1,2],[3,4],[5,6]] * [[10,20,30],[40,50,60]]
Matrix-array multiplication operations are supported if the matrix is the first operand and array is
second. If the matrix’s number of columns matches the arrays length, the resulting array will have the
length as the matrix number of rows.
C = [[1,2],[3,4],[5,6]] * [10,20]
Array-array operations are possible if both arrays are of the same length and supports: addition,
subtraction, multiplication, division and modulo operations. The operation is executed index by index on
both arrays and thus results in an array of the same length. E.g. a[i] b[i] = c[i].
mul = [1,2,3] * [10,20,30]
div = [10,20,30] / [1,2,3]
add = [1,2,3] + [10,20,30]
sub = [10,20,30] - [1,2,3]
mod = [10,20,30] % [1,2,3]
Scalar operations on a matrix or an array are possible. They support addition, subtraction,
multiplication, division and modulo operations. The scalar operations are done on all the entries of the
matrix or the array. E.g. a[i] + b = c[i]
mul1 = [1,2,3] * 5
mul2 = 5 * [[1,2],[3,4],[5,6]]
div1 = [10,20,30] / 10
div2 = 10 / [10,20,30]
e-Series 4 Script Manual
4.Matrix and Array Expressions
Copyright © 2009–2021 by UniversalRobotsA/S. All rights reserved.
add1 = [1,2,3] + 10
add2 = 10 + [1,2,3]
sub1 = [10,20,30] - 5
sub2 = 5 - [[10,20],[30,40]]
mod1 = [11,22,33] % 5
mod2 = 121 % [[10,20],[30,40]]
Script Manual 5 e-Series
4.Matrix and Array Expressions
Copyright © 2009–2021 by UniversalRobotsA/S. All rights reserved.
5.Flow of Control
The flow of control of a program is changed by if-statements:
if a > 3:
a = a + 1
elif b < 7:
b = b * a
else:
a = a + b
end
and while-loops:
l = [1,2,3,4,5]
i = 0
while i < 5:
l[i] = l[i]*2
i = i + 1
end
You can use break to stop a loop prematurely and continue to pass control to the next iteration of
the nearest enclosing loop.
5.1. Special keywords
• halt terminates the program.
return returns from a function. When no value is returned, the keyword None must follow the
keyword return.
e-Series 6 Script Manual
5.Flow of Control
Copyright © 2009–2021 by UniversalRobotsA/S. All rights reserved.
6.Function
A function is declared as follows:
def add(a, b):
return a+b
end
The function can then be called like this:
result = add(1, 4)
It is also possible to give function arguments default values:
def add(a=0,b=0):
return a+b
end
If default values are given in the declaration, arguments can be either input or skipped as below:
result = add(0,0)
result = add()
When calling a function, it is important to comply with the declared order of the ar- guments. If the order
is different from its definition, the function does not work as ex- pected.
Arguments can only be passed by value (including arrays). This means that any modi- fication done to
the content of the argument within the scope of the function will not be reflected outside that scope.
def myProg()
a = [50,100]
fun(a)
def fun(p1):
p1[0] = 25
assert(p1[0] == 25)
...
end
assert(a[0] == 50)
...
end
Script Manual 7 e-Series
6.Function
Copyright © 2009–2021 by UniversalRobotsA/S. All rights reserved.
URScript also supports named parameters.
e-Series 8 Script Manual
6.Function
Copyright © 2009–2021 by UniversalRobotsA/S. All rights reserved.
剩余147页未读,继续阅读
answer1993
- 粉丝: 0
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 社交媒体营销激励优化策略研究
- 终端信息查看工具:qt框架下的输出强制抓取
- MinGW Win32 C/C++ 开发环境压缩包快速入门指南
- STC8G1K08 PWM模块实现10K频率及易改占空比波形输出
- MSP432电机驱动编码器测路程方法解析
- 实现动静分离案例的css/js/img文件指南
- 爱心代码五种:高效编程的精选技巧
- MATLAB实现广义互相关时延估计GCC的多种加权方法
- Hive CDH Jar包下载:免费获取Hive JDBC驱动
- STC8G单片机实现EEPROM及MODBUS-RTU协议
- Java集合框架面试题精讲
- Unity游戏设计与开发资源全集
- 探索音乐盒.zip背后的神秘世界
- Matlab自相干算法GUI界面设计及仿真
- STM32智能小车PID算法实现资料
- Python爬虫实战:高效爬取百度贴吧信息
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功