-
Notifications
You must be signed in to change notification settings - Fork 114
/
8010-get_ft_sensor_config.py
72 lines (64 loc) · 2.01 KB
/
8010-get_ft_sensor_config.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
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
67
68
69
70
71
72
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2019, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <[email protected]> <[email protected]>
"""
Description: save force sensor zero data to xArm controller.
"""
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
from xarm.wrapper import XArmAPI
#######################################################
"""
Just for test example
"""
if len(sys.argv) >= 2:
ip = sys.argv[1]
else:
try:
from configparser import ConfigParser
parser = ConfigParser()
parser.read('../robot.conf')
ip = parser.get('xArm', 'ip')
except:
ip = input('Please input the xArm ip address:')
if not ip:
print('input error, exit')
sys.exit(1)
########################################################
arm = XArmAPI(ip)
# arm.motion_enable(enable=True)
# arm.clean_error()
# arm.set_mode(0)
# arm.set_state(0)
# time.sleep(0.1)
code, config = arm.get_ft_senfor_config()
if code == 0:
print('ft_app_status: {}'.format(config[0]))
print('ft_is_started: {}'.format(config[1]))
print('ft_type: {}'.format(config[2]))
print('ft_id: {}'.format(config[3]))
print('ft_freq: {}'.format(config[4]))
print('ft_mass: {}'.format(config[5]))
print('ft_dir_bias: {}'.format(config[6]))
print('ft_centroid: {}'.format(config[7]))
print('ft_zero: {}'.format(config[8]))
print('imp_coord: {}'.format(config[9]))
print('imp_c_axis: {}'.format(config[10]))
print('M: {}'.format(config[11]))
print('K: {}'.format(config[12]))
print('B: {}'.format(config[13]))
print('f_coord: {}'.format(config[14]))
print('f_c_axis: {}'.format(config[15]))
print('f_ref: {}'.format(config[16]))
print('f_limits: {}'.format(config[17]))
print('kp: {}'.format(config[18]))
print('ki: {}'.format(config[19]))
print('kd: {}'.format(config[20]))
print('xe_limit: {}'.format(config[21]))
arm.disconnect()