Skip to content

Commit f37078b

Browse files
committed
touch
1 parent 43b45d9 commit f37078b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
import sys,os,time,argparse
3+
current_dir = os.path.dirname(os.path.abspath(__file__))
4+
target_dir = os.path.abspath(os.path.join(current_dir, "../.."))
5+
sys.path.append(target_dir)
6+
from LinkerHand.linker_hand_api import LinkerHandApi
7+
from LinkerHand.utils.color_msg import ColorMsg
8+
'''
9+
手掌握拳
10+
'''
11+
def main():
12+
parser = argparse.ArgumentParser(description='处理手势参数')
13+
parser.add_argument('--hand_type', choices=['left', 'right'], required=True, help='指定左手或右手')
14+
parser.add_argument('--hand_joint', required=True, help='指定LinkerHand型号')
15+
parser.add_argument('--can', default="can0", help='指定CAN编号')
16+
args = parser.parse_args()
17+
print(f"手类型: {args.hand_type}, 关节: {args.hand_joint}")
18+
19+
hand_joint = args.hand_joint
20+
hand_type = args.hand_type
21+
can = args.can
22+
# 初始化API
23+
hand = LinkerHandApi(hand_joint=hand_joint,hand_type=hand_type,can=can)
24+
# 设置速度
25+
if hand_joint == "L7":
26+
speed = [120,250,250,250,250,250,250]
27+
else:
28+
speed = [120,250,250,250,250]
29+
hand.set_speed(speed=speed)
30+
ColorMsg(msg=f"当前为{hand_joint} {hand_type},设置速度为:{speed}", color="green")
31+
while True:
32+
matrix_touch = hand.get_matrix_touch()
33+
print("矩阵压感数据")
34+
print(matrix_touch)
35+
time.sleep(0.1)
36+
37+
38+
if __name__ == "__main__":
39+
# python3 linker_hand_get_matrix_touch.py --hand_type left --hand_joint L10
40+
main()

0 commit comments

Comments
 (0)