氣動#
介紹#
VEX EXP 控制器可以使用 Pneumatic 級的方法控制 CTE 氣動系統。這些方法允許控制器控制氣動泵並伸縮氣缸。
對於以下範例,配置的 CTE 氣動電磁閥將被命名為 pneumatic_1 ,並且在本 API 文件中所有後續範例中,當引用 Pneumatic 類方法時,都會使用該名稱。
以下是所有可用方法的清單:
操作 – 控制汽缸和氣壓幫浦。
設定人員-打開或關閉氣動幫浦。
pump– 打開或關閉氣動幫浦。
施工人員 – 手動初始化和配置 CTE 氣動電磁閥。
Pneumatic– 建立一個 CTE 氣動螺線管。
行動#
extend#
extend 伸出汽缸。
Usage:
extend(cylinder)
範圍 |
描述 |
|---|---|
|
要伸出的汽缸:
|
# Extend the first cylinder
pneumatic_1.extend(CYLINDER1)
# Wait 2 seconds
wait(2, SECONDS)
# Retract the first cylinder
pneumatic_1.retract(CYLINDER1)
retract#
retract 縮回氣缸。
Usage:
retract(cylinder)
範圍 |
描述 |
|---|---|
|
The cylinder to retract:
|
# Extend the first cylinder
pneumatic_1.extend(CYLINDER1)
# Wait 2 seconds
wait(2, SECONDS)
# Retract the first cylinder
pneumatic_1.retract(CYLINDER1)
pump_on#
pump_on 打開氣動幫浦。
Usage:
pump_on()
參數 |
描述 |
|---|---|
此方法沒有參數。 |
# Turn the pneumatic pump on
pneumatic_1.pump_on()
pump_off#
pump_off 關閉氣動幫浦。
Usage:
pump_off()
參數 |
描述 |
|---|---|
此方法沒有參數。 |
# Turn the pneumatic pump off
pneumatic_1.pump_off()
二傳手#
pump#
pump 打開或關閉氣動幫浦。
Usage:
pump(state)
範圍 |
描述 |
|---|---|
|
要設定的狀態: |
# Turn the pneumatic pump on
pneumatic_1.pump(True)
# Turn the pneumatic pump off
pneumatic_1.pump(False)
建構函數#
Pneumatic#
Pneumatic 創建氣動系統。
Pneumatic(smartport)
範圍 |
描述 |
|---|---|
|
氣動電磁閥連接的智慧型端口,記為 |
# Construct a Pneumatic System "pneumatic_1" with the
# Pneumatic class
pneumatic_1 = Pneumatic(Ports.PORT1)