|
@@ -1,13 +1,4 @@
|
|
|
-'''
|
|
|
-@Author : liujunshen
|
|
|
-@Ide : vscode
|
|
|
-@File : fubo_pneumatic_finger.py
|
|
|
-@Time : 2023/04/03 16:49:11
|
|
|
-'''
|
|
|
-
|
|
|
-
|
|
|
import logging
|
|
|
-import time
|
|
|
|
|
|
import serial
|
|
|
from serial.tools.list_ports import comports
|
|
@@ -23,6 +14,23 @@ def get_serial_ports():
|
|
|
return available_ports_list
|
|
|
|
|
|
|
|
|
+class FingerController:
|
|
|
+ def __init__(self, init_params):
|
|
|
+ self.hand = FuboPneumaticFingerClient(init_params)
|
|
|
+ self.current_state = 'rest'
|
|
|
+
|
|
|
+ def move(self, action='flex'):
|
|
|
+ if self.current_state == 'extend':
|
|
|
+ self.hand.start(action)
|
|
|
+ self.current_state = action
|
|
|
+ elif self.current_state == action:
|
|
|
+ self.hand.start('extend')
|
|
|
+ self.current_state = 'extend'
|
|
|
+ else: # rest or any other
|
|
|
+ self.hand.start(action)
|
|
|
+ self.current_state = action
|
|
|
+
|
|
|
+
|
|
|
class FuboPneumaticFingerClient:
|
|
|
"""富伯客户端"""
|
|
|
|