ระบบนิวแมติกส์#

การแนะนำ#

ตัวควบคุมหลัก VEX V5 สามารถควบคุมระบบ CTE Pneumatic System โดยใช้คลาส pneumatic คลาสนี้ช่วยให้ตัวควบคุมหลักสามารถควบคุมปั๊มลมและยืดหรือหดกระบอกสูบลมได้

หมายเหตุ: คำสั่ง CTE Pneumatic ต้องการโมดูล CTE นำเข้าโดยใช้ using namespace cte;.

ตัวสร้างคลาส#

pneumatic( 
  int32_t index );

ตัวทำลายคลาส#

ทำลายวัตถุ pneumatic และปล่อยทรัพยากรที่เกี่ยวข้อง

~pneumatic();

พารามิเตอร์#

พารามิเตอร์

พิมพ์

คำอธิบาย

index

int32_t

พอร์ตอัจฉริยะที่โซลินอยด์นิวแมติก CTE เชื่อมต่ออยู่ (เช่น PORT1)

หมายเหตุ#

  • คำสั่งควบคุมระบบลมของ CTE จะใช้งานได้เฉพาะกับชิ้นส่วนของ 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 Functions
void extend( 
  cylinderType id );

Parameters

พารามิเตอร์

พิมพ์

คำอธิบาย

id

cylinderType

กระบอกสูบที่จะขยาย:

  • cylinder1
  • cylinder2
  • cylinder3
  • cylinder4
  • cylinderAll – กระบอกสูบทั้ง 4

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Extend cylinder 1
ctePneumatic1.extend(cylinder1);

// Extend all cylinders
ctePneumatic1.extend(cylinderAll);

retract#

ดึงกระบอกสูบแบบนิวแมติกกลับ

Available Functions
void retract( 
  cylinderType id );

Parameters

พารามิเตอร์

พิมพ์

คำอธิบาย

id

cylinderType

กระบอกสูบที่จะหดกลับ:

  • cylinder1
  • cylinder2
  • cylinder3
  • cylinder4
  • cylinderAll – กระบอกสูบทั้ง 4

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Retract cylinder 2
ctePneumatic1.retract(cylinder2);

// Retract all cylinders
ctePneumatic1.retract(cylinderAll);

pump_on#

เปิดใช้งานปั๊มลม

Available Functions
void pump_on();

Parameters

ฟังก์ชันนี้ไม่มีพารามิเตอร์

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Turn the pneumatic pump on
ctePneumatic1.pump_on();

pump_off#

ปิดปั๊มลม

Available Functions
void pump_off();

Parameters

ฟังก์ชันนี้ไม่มีพารามิเตอร์

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Turn the pneumatic pump off
ctePneumatic1.pump_off();

pump#

เปิดหรือปิดปั๊มลม

Available Functions
void pump( 
  bool state );

Parameters

พารามิเตอร์

พิมพ์

คำอธิบาย

state

bool

สถานะที่จะตั้งค่า: true เปิดปั๊มลม false ปิดปั๊มลม

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Turn the pump on
ctePneumatic1.pump(true);

// Turn the pump off
ctePneumatic1.pump(false);

installed#

ตรวจสอบว่าโซลินอยด์ลม CTE เชื่อมต่อกับสมองหรือไม่

Available Functions
bool installed();

Parameters

ฟังก์ชันนี้ไม่มีพารามิเตอร์

Return Values

ส่งคืนค่าบูลีนที่ระบุว่าโซลินอยด์เชื่อมต่อกับตัวควบคุมหลักหรือไม่

  • true ถ้าโซลินอยด์เชื่อมต่อกับสมอง

  • false ถ้าโซลินอยด์ไม่ได้เชื่อมต่อกับสมอง

Examples
// Check if the pneumatic solenoid is connected
if (ctePneumatic1.installed()) {
  // Pneumatic system is ready
  ctePneumatic1.pump_on();
}