-
Notifications
You must be signed in to change notification settings - Fork 112
/
0002-get_property.py
81 lines (65 loc) · 2.04 KB
/
0002-get_property.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
73
74
75
76
77
78
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2019, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <[email protected]> <[email protected]>
"""
Description: Get the property of XArmAPI
Note: is_radian is different when instantiating, some attribute values are different
"""
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.set_mode(0)
arm.set_state(state=0)
time.sleep(1)
print('=' * 50)
print('default_is_radian:', arm.default_is_radian)
print('version:', arm.version)
print('state:', arm.state)
print('mode:', arm.mode)
print('cmdnum:', arm.cmd_num)
print('error_code:', arm.error_code)
print('warn_code:', arm.warn_code)
print('collision_sensitivity:', arm.collision_sensitivity)
print('teach_sensitivity:', arm.teach_sensitivity)
print('world_offset:', arm.world_offset)
print('gravity_direction:', arm.gravity_direction)
print('============TCP============')
print('* position:', arm.position)
print('* tcp_jerk:', arm.tcp_jerk)
print('* tcp_load:', arm.tcp_load)
print('* tcp_offset:', arm.tcp_offset)
print('* tcp_speed_limit:', arm.tcp_speed_limit)
print('* tcp_acc_limit:', arm.tcp_acc_limit)
print('===========JOINT===========')
print('* angles:', arm.angles)
print('* joint_jerk:', arm.joint_jerk)
print('* joint_speed_limit:', arm.joint_speed_limit)
print('* joint_acc_limit:', arm.joint_acc_limit)
print('* joints_torque:', arm.joints_torque)
arm.disconnect()