空気圧#
導入#
VEX V5 Brainは、 pneumatic クラスを使用してCTE Pneumaticシステムを制御できます。このクラスにより、Brainは空気圧ポンプを制御し、空気圧シリンダーを伸縮させることができます。
注: CTE 空圧コマンドには CTE モジュールが必要です。 using namespace cte;を使用してインポートします。
クラスコンストラクタ#
pneumatic(
int32_t index );
クラスデストラクタ#
pneumatic オブジェクトを破壊し、関連するリソースを解放します。
~pneumatic();
パラメータ#
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
CTE空圧ソレノイドが接続されているスマートポート(例:PORT1)。 |
注記#
CTE Pneumaticのコマンドは、CTE Pneumatic製の部品でのみ動作します。
CTEモジュールを手動でインポートする必要があります:
using namespace cte;。このシステムは、最大4つのシリンダーを個別に、またはすべて同時に制御できます。
例#
using namespace cte;
// Create a CTE Pneumatic Solenoid in Port 1
pneumatic ctePneumatic1 = pneumatic(PORT1);
// Turn on the pump and extend cylinder 1
ctePneumatic1.pump_on();
ctePneumatic1.extend(cylinder1);
メンバーの機能#
pneumatic クラスには、以下のメンバ関数が含まれます。
extend— 円柱を拡張します。retract— シリンダーを収縮させます。pump_on— 空気圧ポンプをオンにします。pump_off— 空気圧ポンプをオフにします。pump— 空気圧ポンプのオン/オフを切り替えます。installed— ソレノイドが脳に接続されているかどうかを返します。
pneumatic メンバー関数を呼び出す前に、以下に示すように pneumatic インスタンスを作成する必要があります。
using namespace cte;
/* This constructor is required to use a
CTE Pneumatic Solenoid. Replace the values
as needed. */
// Create the pneumatic instance on Port 1
pneumatic ctePneumatics1 = pneumatic(PORT1);
extend#
空気圧シリンダーを伸長させる。
Available Functionsvoid extend(
cylinderType id );
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
延長するシリンダー:
|
この関数は値を返しません。
Examples// Extend cylinder 1
ctePneumatic1.extend(cylinder1);
// Extend all cylinders
ctePneumatic1.extend(cylinderAll);
retract#
空気圧シリンダーを格納します。
Available Functionsvoid retract(
cylinderType id );
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
引き込むシリンダー:
|
この関数は値を返しません。
Examples// Retract cylinder 2
ctePneumatic1.retract(cylinder2);
// Retract all cylinders
ctePneumatic1.retract(cylinderAll);
pump_on#
空気圧ポンプのスイッチを入れる。
Available Functionsvoid pump_on();
この関数には引数がありません。
Return Valuesこの関数は値を返しません。
Examples// Turn the pneumatic pump on
ctePneumatic1.pump_on();
pump_off#
空気圧ポンプを停止します。
Available Functionsvoid pump_off();
この関数には引数がありません。
Return Valuesこの関数は値を返しません。
Examples// Turn the pneumatic pump off
ctePneumatic1.pump_off();
pump#
空気圧ポンプのオン/オフを切り替えます。
Available Functionsvoid pump(
bool state );
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
設定する状態: |
この関数は値を返しません。
Examples// Turn the pump on
ctePneumatic1.pump(true);
// Turn the pump off
ctePneumatic1.pump(false);
installed#
CTE空気圧ソレノイドがブレインに接続されているかどうかを返します。
Available Functionsbool installed();
この関数には引数がありません。
Return Valuesソレノイドがブレインに接続されているかどうかを示すブール値を返します。
trueソレノイドが脳に接続されている場合。falseソレノイドがブレインに接続されていない場合。
// Check if the pneumatic solenoid is connected
if (ctePneumatic1.installed()) {
// Pneumatic system is ready
ctePneumatic1.pump_on();
}