-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_zero.py
More file actions
66 lines (48 loc) · 1.58 KB
/
Copy pathtest_zero.py
File metadata and controls
66 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
ゼロ調整テスト
フォースプレートに接続してゼロ調整を実行する
"""
from forceplate import ForcePlate, RmtStatus
def main():
print("=" * 60)
print("フォースプレート ゼロ調整テスト")
print("=" * 60)
fp = ForcePlate()
# デバイスリスト表示
print("\n[接続可能なデバイス一覧]")
devices = fp.list_devices()
if not devices:
print(" デバイスが見つかりません")
return
for dev in devices:
print(f" [{dev['index']}] {dev['description']} (Serial: {dev['serial']})")
# 最初のデバイスに接続
print("\n[接続処理]")
if not fp.connect(0):
print(" 接続失敗")
return
print(" 接続成功")
print(f" シリアル番号: {fp.rmt_info.serial}")
print(f" ステータス: {fp.status.name}")
# ゼロ調整前の確認
if fp.status != RmtStatus.IDLE:
print(f"\n ゼロ調整はIdle状態でのみ可能です(現在: {fp.status.name})")
fp.disconnect()
return
# ゼロ調整実行
print("\n[ゼロ調整]")
print(" ゼロ調整中... (フォースプレートに荷重をかけないでください)")
if fp.zero():
print(" ゼロ調整完了")
else:
print(" ゼロ調整失敗")
print(f" 現在のステータス: {fp.status.name}")
# 切断
print("\n[切断処理]")
fp.disconnect()
print(" 切断完了")
print("\n" + "=" * 60)
print("テスト完了")
print("=" * 60)
if __name__ == "__main__":
main()