-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcalibrate.py
More file actions
31 lines (27 loc) · 931 Bytes
/
calibrate.py
File metadata and controls
31 lines (27 loc) · 931 Bytes
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
import os
import sys
import exoboot
import time
import csv
import util
import constants
def calibrate_encoder_to_ankle_conversion(exo: exoboot.Exo):
'''This routine can be used to manually calibrate the relationship
between ankle and motor angles. Move through the full RoM!!!'''
exo.update_gains(Kp=constants.DEFAULT_KP, Ki=constants.DEFAULT_KI,
Kd=constants.DEFAULT_KD, ff=constants.DEFAULT_FF)
exo.command_current(exo.motor_sign*2000)
print('begin!')
for _ in range(1000):
time.sleep(0.02)
exo.read_data()
exo.write_data()
print('Done! File saved.')
if __name__ == '__main__':
exo_list = exoboot.connect_to_exos(file_ID='calibration2')
if len(exo_list) > 1:
raise ValueError("Just turn on one exo for calibration")
exo = exo_list[0]
exo.standing_calibration()
calibrate_encoder_to_ankle_conversion(exo=exo)
exo.close()