当前位置: 首页 > news >正文

基于OPC UA 的运动控制读书笔记(1)

      最近一段时间集中研究OPCUA 在机器人控制应用中应用的可能性。这个话题自然离不开运动控制。

    笔者对运动控制不是十分了解。于是恶补EtherCAT 驱动,PLCopen 运动控制的知识,下面是自己的读书笔记和实现OPCUA /IEC61499 运动控制器的实现方案设想。

PLCopen 功能块库

   早期的运动控制是使用运动控制器实现的,PLCopen 提供了运动控制的功能块库,从而使PLC 能够成为“运动控制器”。

        PLCopen 提供了运动控制功能块库。PLC 厂商提供符合PLCopen 规范的运动控制功能块库,用户可以使用标准的功能块实现运动控制应用。 

结构数据类型

AXIS_REF

        几乎所有的运动控制功能块都使用AXIS_REF 数据类型,用于描述轴的属性,不同的制造商规定了不同轴的属性,其包含的变量可多大数百个,主要包括:

  • 基本信息
  • 管理信息
  • 运动参数信息
  • 出错信息
  • 其它信息

        根据 PLCopen 的定义,AXIS_REF结构的内容特定于每个制造商。在 ISG 实现的版本中,AXIS_REF包含轴索引的变量hli_axis_idx,可以使用该变量对 HLI 上的轴特定区域进行寻址。 在OPCUA/IEC61499 平台上,可以使用OPCUA 构建轴模型,而AXIS 可以是轴的OPCUA 节点路径(Path String)。

 Acceleration Deceleration Jerk

 加速度 Acceleration

减速度 Deceleration

加加速度 Jerk

Jerk是加速度对时间的导数,单位是m/s3 ,即米/秒的3次方。Jerk可以看做是加速度的变化率。

一些例子:

 

 

PLCopen功能块

单轴运动功能块

MC_Power

MC_Power开关Axis 指定的驱动器的电源。

VAR_IN_OUT

Variable name

Data type

Description

Axis

AXIS_REF

Axis reference

VAR_INPUT

Variable name

Data type

Description

Enable

BOOL

Must have the value TRUE otherwise power cannot be switched on.

Enable_Positive

BOOL

Must have the value TRUE otherwise power cannot be switched on.

Enable only for positive motion direction is not supported.

Enable_Negative

BOOL

Must have the value TRUE otherwise power cannot be switched on.

Enable only for negative motion direction is not supported.

PowerDefaultState

MCV_DRIVE_
POWER_STATE

Function available for CANopen drives:

The function block sets the drive to this state as long as the “Status” output indicates FALSE, i.e. at least one of the Enable... inputs is assigned the value FALSE (see table below). The input is assigned mcvPowerStateDefault as default value

VAR_OUTPUT

Variable name

Data type

Description

Status

BOOL

TRUE indicates that the drive has torque applied and is in control mode.

Error

BOOL

Indicates whether an error occurred in the FB.

ErrorID

WORD

Error identifier

DriveEnabled

BOOL

TRUE indicates that the drive is ready for enabling power.

DriveReady

BOOL

TRUE indicates that the drive is being controlled.

PowerState

MCV_DRIVE_
POWER_STATE

State in which the drive is currently (see table below).

MC_Home

VAR_IN_OUT

Variable name

Data type

Description

axis

AXIS_REF

Axis reference

VAR_INPUT

Variable name

Data type

Description

Execute

BOOL

Homing is commanded on a rising edge at the input.

CamSignal

BOOL

Signal to command adoption of the homing position. For further application notes, see Section 2.8.1.

VAR_OUTPUT

Variable name

Data type

Description

Done

BOOL

When TRUE, homing is completed and the axis is in “Standstill” state.

CommandAborted

BOOL

TRUE indicates that the command was aborted by another command.

Error

BOOL

Is TRUE when an error occurs in the FB.

ErrorID

WORD

Error code.

MC_MoveAbsolute

VAR_INPUT

Variable name

Data type

Description

Execute

BOOL

A rising edge at the input commands the motion to an absolute position.

Position

LREAL

Target position of the motion,
Value range [-2147483648.0, 2147483647.0]
Default unit [0.1µm or 10-4 °]

Velocity

LREAL

Maximum velocity of the motion. This value must be specified positive. The velocity is not necessarily reached.

Value range [1.0, 2147483647.0]
Default unit [1µm/s or 10-3 °/s]

Acceleration

LREAL

Acceleration value. This value must be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Deceleration

LREAL

Deceleration value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Jerk

LREAL

Jerk value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s3 or 1°/s3]

Direction

INT

Direction in which the motion is started. One of the 4 values:

   1     positive direction

   2     shortest path

   3     negative direction

   4     current direction

Specifying the direction is effective only if a modulo coordinate system was defined for the axis in the axis-specific machine data using parameter kenngr.achs_mode (P-AXIS-00015) since the direction is always unambiguous with linear axes.

VAR_OUTPUT

Variable name

Data type

Description

Done

BOOL

The axis is within a range close to the target position. The range is specified by the parameter getriebe[...].window (P-AXIS-00236) of the axis-specific machine data.

CommandAborted

BOOL

TRUE indicates that the command was aborted by another command.

Error

BOOL

Is TRUE if an error occurs in the FB.

ErrorID

WORD

Error identifier

Position 

        以用户自定义单位表示的目标绝对位置。ISG Kernel 中为0.1 µm 。

MC_MoveAdditive

VAR_IN_OUT

Variable name

Data type

Description

Axis

AXIS_REF

Axis reference

VAR_INPUT

Variable name

Data type

Description

Execute

BOOL

The motion starts on the rising edge of this input signal.

Distance

LREAL

Target position of the motion,

Value range [-2147483648.0, 2147483647.0]
Default unit [0.1µm or 10-4 °]

Velocity

LREAL

Maximum velocity of the motion. This value must be specified positive. The velocity is not necessarily reached.

Value range [1.0, 2147483647.0]
Default unit [1µm/s or 10-3 °/s]

Acceleration

LREAL

Acceleration value. This value must be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Deceleration

LREAL

Deceleration value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Jerk

LREAL

Jerk value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s3 or 1°/s3]

VAR_OUTPUT

Variable name

Data type

Description

Done

BOOL

The axis is within a range close to the target position. The range is specified by the parameter getriebe[...].window (P-AXIS-00236) of the axis-specific machine data.

CommandAborted

BOOL

TRUE indicates that the command was aborted by another command.

Error

BOOL

Is TRUE if an error occurs in the FB.

ErrorID

WORD

Error identifier

MC_MoveRelative

VAR_IN_OUT

Variable name

Data type

Description

Axis

AXIS_REF

Axis reference

VAR_INPUT

Variable name

Data type

Description

Execute

BOOL

The motion starts at the rising edge of this input signal.

Distance

LREAL

Relative distance for the motion.

Value range [-2147483648.0, 2147483647.0]
Default unit [0.1µm or 10-4 °]

Velocity

LREAL

Maximum velocity of the motion. This value must be specified positive. The velocity is not necessarily reached.

Value range [1.0, 2147483647.0]
Default unit [1µm/s or 10-3 °/s]

Acceleration

LREAL

Acceleration value. This value must be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Deceleration

LREAL

Deceleration value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Jerk

LREAL

Jerk value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s3 or 1°/s3]

VAR_OUTPUT

Variable name

Data type

Description

Done

BOOL

The axis is within a range close to the target position. The range is specified by the parameter getriebe[...].window (P-AXIS-00236) of the axis-specific machine data.

CommandAborted

BOOL

TRUE indicates that the command was aborted by another command.

Error

BOOL

Is TRUE if an error occurs in the FB.

ErrorID

WORD

Error identifier

MC_MoveVelocity

VAR_INPUT

Variable name

Data type

Description

Execute

BOOL

The motion starts at the rising edge of this input signal.

Velocity

LREAL

Velocity value of endless motion. This value must be specified positive.

Value range [1. 0, 2147483647.0]
Default unit [1µm/s or 10-3 °/s]

Acceleration

LREAL

Acceleration value. This value must be specified positive.

Value range [0. 0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Deceleration

LREAL

Deceleration value. This value must be always be specified positive.

Value range [0. 0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Jerk

LREAL

Jerk value. This value must be always be specified positive.

Value range [0. 0, 2147483647.0]
Default unit [1mm/s3 or 1°/s3]

Direction

INT

Direction in which the motion is started. One of the 3 values:

Positive direction

 3     negative direction

  4     current direction

VAR_OUTPUT

Variable name

Data type

Description

InVelocity

BOOL

The commanded velocity was reached (for the first time).

CommandAborted

BOOL

TRUE indicates that the command was aborted by another command.

Error

BOOL

Is TRUE if an error occurs in the FB.

ErrorID

WORD

Error identifier

MC_Stop

VAR_IN_OUT

Variable name

Data type

Description

Axis

AXIS_REF

Axis reference

VAR_INPUT

Variable name

Data type

Description

Execute

BOOL

Starts the command on the rising edge.

Deceleration

LREAL

Deceleration value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s2 or 1°/s2]

Jerk

LREAL

Jerk value. This value must be always be specified positive.

Value range [0.0, 2147483647.0]
Default unit [1mm/s3 or 1°/s3]

VAR_OUTPUT

Variable name

Data type

Description

Done

BOOL

0 velocity was reached.

Caution: The "Done“ output merely indicates that the axis is stationary. The automatic axis state indicator remains initially in the STOPPING state. Only when the "Execute” input is also FALSE does the automatic axis state indicator change to the “STANDSTILL” state.

Error

BOOL

Is TRUE if an error occurs in the FB.

ErrorID

WORD

Error identifier

多轴功能块

Function block

PLC systems

3S

TwinCAT

KW

MC_AddAxisToGrp

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpContinue

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpDisable

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpEnable

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpHalt

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpInterrupt

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpReadActPos

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpReadError

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpReadInfo

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpReadStatus

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpReset

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpSetOverride

SIMU
-

SIMU
-

SIMU

KUKA

MC_GrpStop

SIMU
-

SIMU
-

SIMU

KUKA

MC_MoveCircAbs

SIMU
-

SIMU
-

SIMU

KUKA

MC_MoveCircRel

SIMU
-

SIMU
-

SIMU

KUKA

MC_MoveDirAbs

SIMU
-

SIMU
-

SIMU

KUKA

MC_MoveLinAbs

SIMU
-

SIMU
-

SIMU

KUKA

MC_MoveLinRel

SIMU
-

SIMU
-

SIMU

KUKA

MC_MovePath

SIMU
-

SIMU
-

SIMU

KUKA

MC_RemAxisFromGrp

SIMU
-

SIMU
-

SIMU

KUKA

MC_SetCartTrans

SIMU
-

SIMU
-

SIMU

KUKA

MC_SetKinTrans

SIMU
-

SIMU
-

SIMU

KUKA

MC_UngroupAllAxes

SIMU
-

SIMU
-

SIMU

KUKA

 主要的轴组功能块

        在运动控制应用中,往往是多个轴协同运动,并且在2D/3D坐标系中运动。PLCopen Part4 是2D/3D 的坐标运动,它将多个轴构成轴组。机械臂,机器人等应用应该是多轴应用。下面是一些轴组的运动控制功能块。

     这些轴组运动控制功能块看上去与单轴类似,其实内部实现要复杂的多。

MC_AddAxisToGrp

添加轴到轴组。

VAR_IN_OUT

Variable name

Data type

Description

AxesGroup

AXES_GROUP_REF

Axis group reference

axis

AXIS_REF

Axis reference

VAR_INPUT

Variable name

Data type

Description

Execute

BOOL

The axis is added to the axis group on a rising edge.

IdentInGroup

IDENT_IN_GROUP_REF

Identification of the axis in the axis group.

VAR_OUTPUT

Variable name

Data type

Description

Done

BOOL

TRUE indicates that axis was added to the axis group.

Busy

BOOL

TRUE indicates that the function block is executing a job.

Error

BOOL

TRUE indicates that an error occurred.

ErrorID

WORD

Error code.

 MC_MoveCircAbs

MC_MoveCircRel 

MC_MoveLinAbs 

 

MC_MoveLinRel 

MC_MovePath 

坐标系

机械坐标系(MCS)

相对于机械装置的坐标系统,通常是笛卡尔直角坐标系。

 产品坐标系(PCS)

也称为工件坐标系。它基于MCS ,经过坐标变换而成。

轴坐标系(ACS)

它基于物理轴,它们可以是笛卡尔坐标系,也可以是极坐标或者其它坐标系。

      坐标系转换应该是运动控制功能块内部实现。

实现平台架构 

        本文探讨基于OPCUA/IEC61499 平台实现PLCopen 运动控制信息模型和功能块的软件架构。最终目的是使用OPCUA 和IEC61499 平台实现机器人控制。

实验平台的功能

  • 使用OPCUA 构建轴模型
  • 使用IEC61499 构建运动控制功能块
  • 使用IEC61499 功能块网络实现运动控制应用

OPCUA 信息模型

参照笔者的博文:OPCUA 配套协议:机器人

IEC61499 功能块

        IEC61499 没有支持PLCopen 运动控制功能块。需要自行定义和开发类似于PLCopen 的运动控制FB。

        IEC61131-3 功能块是不分事件和数据的。当转换为IEC61499 功能块时,需要区分一下。如下图所示。

测试实例:

    在上面的网络图中,我们只是测试了MC_Home,MC_moveVelocity ,MC_Stop 三个功能块。 具体参数的设置参考松下A6 伺服驱动器。

系统架构

EtherCAT 伺服驱动器

        在这里,我们先以基于EtherCAT和CANopen 总线的伺服驱动器作为底层驱动,OPCUA/IEC61499 平台作为运动控制器。运动控制器是EtherCAT Master,伺服驱动器是Ether CAT的从设备。

实验中使用松下公司的A6 Ethercat伺服。

Ether CAT master

        使用开源项目 IgH EtherCAT Master。

架构

         在运动控制系统中最基本的控制对象是轴。轴同时对应于底层的伺服驱动器(我们假设一个伺服驱动器控制一个物理的轴)。多个轴的参数,控制命令和状态是通过EtherCAT PDO 级联方式传递的。所以轴具有承上启下功效的对象。

     在OPCUA /IEC61499 平台上,可以使用OPCUA 信息模型描述轴的模型,类似于AXIS_REF包含的属性。OPCUA /IEC61499平台运行时根据轴模型构建内部的AXIS 对象(AXIS Class)实例。AXIS 对象实现运动控制块到EtherCAT 网络的映射(Mapping)。使用IEC61499 功能块实现类似PLCopen的功能块。

    使用OPCUA 构建轴模型,运行时内部有对应的AXIS 对象。61499功能块修改AXIS 对象的参数,EtherCAT master 周期性地AXIS 与物理伺服驱动器交换数据。 

结束语

        运动控制是十分复杂的系统,涉及机械,电子控制的知识非常多。实现一个真正实用的运动控制功能块及其运行时是不容易的。需要时间与经验的积累。唯有前行,方得收获。

相关文章:

  • HCIA-RS基础:动态路由协议基础
  • 支持Arm CCA的TF-A威胁模型
  • 系列九、声明式事务(xml方式)
  • pop链反序列化 [MRCTF2020]Ezpop1
  • 微信小程序便民小工具源码
  • Kotlin学习——kt中的类,数据类 枚举类 密封类,以及对象
  • CAN通信协议
  • 论文导读 | 10月专题内容精选:人的预测
  • 面向对象编程:Rust的面向对象特性
  • 电机应用-直流有刷电机多环控制实现
  • Namecheap怎么样,Namecheap优惠码以及注册手把手教程
  • 4.整数输入,并输出变量类型【2023.11.26】
  • Docker Swarm总结+CI/CD Devops、gitlab、sonarqube以及harbor的安装集成配置(3/4)
  • 计算机毕业设计 基于Hadoop的物品租赁系统的设计与实现 Java实战项目 附源码+文档+视频讲解
  • 性能测试必看系列之Jmeter:硬件性能监控指标
  • php的引用
  • [NodeJS] 关于Buffer
  • JSONP原理
  • Leetcode 27 Remove Element
  • Mysql5.6主从复制
  • Python爬虫--- 1.3 BS4库的解析器
  • ReactNative开发常用的三方模块
  • Vue.js源码(2):初探List Rendering
  • vue的全局变量和全局拦截请求器
  • 阿里云容器服务区块链解决方案全新升级 支持Hyperledger Fabric v1.1
  • 回顾 Swift 多平台移植进度 #2
  • 将 Measurements 和 Units 应用到物理学
  • 看域名解析域名安全对SEO的影响
  • 前端js -- this指向总结。
  • 如何利用MongoDB打造TOP榜小程序
  • 删除表内多余的重复数据
  • 使用 Node.js 的 nodemailer 模块发送邮件(支持 QQ、163 等、支持附件)
  • 微信小程序--------语音识别(前端自己也能玩)
  • 小而合理的前端理论:rscss和rsjs
  • ​DB-Engines 11月数据库排名:PostgreSQL坐稳同期涨幅榜冠军宝座
  • "无招胜有招"nbsp;史上最全的互…
  • ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
  • #经典论文 异质山坡的物理模型 2 有效导水率
  • #图像处理
  • (04)odoo视图操作
  • (2022 CVPR) Unbiased Teacher v2
  • (ibm)Java 语言的 XPath API
  • (超详细)语音信号处理之特征提取
  • (附源码)ssm航空客运订票系统 毕业设计 141612
  • (附源码)计算机毕业设计ssm基于B_S的汽车售后服务管理系统
  • (亲测)设​置​m​y​e​c​l​i​p​s​e​打​开​默​认​工​作​空​间...
  • (数据结构)顺序表的定义
  • (转)c++ std::pair 与 std::make
  • (转)linux下的时间函数使用
  • (转载)深入super,看Python如何解决钻石继承难题
  • .locked1、locked勒索病毒解密方法|勒索病毒解决|勒索病毒恢复|数据库修复
  • .Net MVC + EF搭建学生管理系统
  • .NET MVC第五章、模型绑定获取表单数据
  • .net 简单实现MD5
  • .Net下C#针对Excel开发控件汇总(ClosedXML,EPPlus,NPOI)