气动#
气动命令仅适用于 CTE 气动部件。
初始化气动类#
使用以下构造函数创建气动系统:
气动(端口)
此构造函数使用一个参数:
范围 |
描述 |
---|---|
|
与气动电磁阀连接的有效 智能端口。 |
# Construct a Pneumatic System "pneumatic_1" with the
# Pneumatic class.
pneumatic_1 = Pneumatic(Ports.Port1)
当引用气动类方法时,此“pneumatic_1”对象将在整个 API 文档的所有后续示例中使用。
类方法#
extend()#
extend(value)
方法延伸圆柱体。
参数 |
描述 |
---|---|
价值 |
有效的 CylinderType。 |
**返回:**无。
# Extend the first cylinder.
pnuematic_1.extend(CYLINDER1)
# Wait 2 seconds.
wait(2, SECONDS)
# Retract the first cylinder.
pnuematic_1.retract(CYLINDER1)
retract()#
retract(value)
方法缩回圆柱体。
参数 |
描述 |
---|---|
价值 |
有效的 CylinderType。 |
**返回:**无。
# Extend the first cylinder.
pnuematic_1.extend(CYLINDER1)
# Wait 2 seconds.
wait(2, SECONDS)
# Retract the first cylinder.
pnuematic_1.retract(CYLINDER1)
pump_on()#
pump_on()
方法打开气动气泵。
**返回:**无。
# Turn air pump on.
pnuematic_1.pump_on()
pump_off()#
pump_off()
方法关闭气动气泵。
**返回:**无。
# Turn air pump off.
pnuematic_1.pump_off()
pump()#
pump(state)
方法打开或关闭气动气泵。
参数 |
描述 |
---|---|
状态 |
压缩机状态。“True”表示开启。“False”表示关闭。 |
**返回:**无。
# Turn air pump on.
pnuematic_1.pump(True)
# Turn air pump off.
pnuematic_1.pump(False)
status()#
status()
方法返回气动装置的原始状态。
**返回:**气动装置的原始状态(整数)。
installed()#
installed()
方法检查设备连接。
返回: 如果设备已连接,则返回 True
。如果未连接,则返回 False
。
timestamp()#
timestamp()
方法返回从气动系统接收到的最后一个状态包的时间戳。
**返回:**最后接收的状态包的时间戳(以毫秒为单位)。