forked from maxshep/Exoboot_Code
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalibrate.py
34 lines (30 loc) · 1.04 KB
/
calibrate.py
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
import os
import sys
import exoboot
import time
import csv
import util
import constants
import config_util
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*1000)
print('begin!')
for _ in range(1000):
exo.command_current(exo.motor_sign*1000)
time.sleep(0.02)
exo.read_data()
exo.write_data()
print('Done! File saved.')
if __name__ == '__main__':
config = config_util.load_config_from_args()
exo_list = exoboot.connect_to_exos(file_ID='calibration2',config=config)
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()