CTE气动系统#

介绍#

CTE气动指令仅适用于CTE气动部件。您需要手动导入CTE模块才能使其正常工作。

from cte import *

CTE气动系统采用气泵和电磁阀来控制压缩空气,从而驱动气缸运动。它可以通过代码控制气泵的开启和关闭,以及气缸的伸出和缩回。

This page uses cte_pneumatic as the example CTE Pneumatics name. Replace it with your own configured name as needed.

以下是可用方法列表:

  • extend – Extend a cylinder.

  • retract – Retract a cylinder.

  • pump_on – Turn on the air pump.

  • pump_off – Turn off the air pump.

  • pump – Set the on or off state of the air pump.

  • installed – Returns whether or not a CTE Pneumatic Solenoid is connected to the Brain.

构造函数 - 手动初始化和配置 CTE 气动电磁阀。

  • Pneumatic – Creates a CTE Pneumatic Solenoid.

延长#

extend extends a cylinder.

Usage:
cte_pneumatic.extend(cylinder)

参数

描述

cylinder

The cylinder to extend:

  • CYLINDER1
  • CYLINDER2
  • CYLINDER3
  • CYLINDER4
  • CYLINDERALL – All 4 cylinders

缩回#

retract retracts a cylinder.

Usage:
cte_pneumatic.retract(cylinder)

参数

描述

cylinder

The cylinder to retract:

  • CYLINDER1
  • CYLINDER2
  • CYLINDER3
  • CYLINDER4
  • CYLINDERALL – All 4 cylinders

泵开启#

pump_on turns the air pump on.

Usage:
cte_pneumatic.pump_on()

参数

描述

此方法没有参数。

泵关闭#

pump_off turns the air pump off.

用法:

cte_pneumatic.pump_off()

参数

描述

此方法没有参数。

#

pump turns the air pump on or off.

用法:

cte_pneumatic.pump(state)

参数

描述

state

The air pump state:

  • True – Turn the air pump on.
  • False – Turn the air pump off.

已安装#

installed returns a Boolean indicating whether the CTE Pneumatic Solenoid is connected to the Brain.

  • True - The solenoid is connected to the Brain.

  • False - The solenoid is not connected to the Brain.

用法:

cte_pneumatic.installed()

参数

描述

此方法没有参数。

构造函数#

Constructors are used to manually create Pneumatic objects, which are necessary for configuring a CTE Pneumatic Solenoid.

Pneumatic#

Pneumatic creates a CTE Pneumatic Solenoid.

Usage:
Pneumatic(smartport)

范围

描述

smartport

The Smart Port that the CTE Pneumatic Solenoid is connected to, written as Ports.PORTx where x is the number of the port.

from cte import *

# Create a CTE Pneumatic Solenoid in Port 1
cte_pneumatic = Pneumatic(Ports.PORT1)