This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
robot_calibrate.py
75 lines (54 loc) · 1.99 KB
/
robot_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
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
import rospy
from baxter.hand import KeyboardManipulator
"""
This script calibrate your Baxter to set up:
* borders of the table
* default position
* limb height from table
"""
class RobotCalibrator:
def __init__(self, limb):
self.manipulator = KeyboardManipulator(limb)
def default_position(self):
pose = self.manipulator.listen()
return pose[:3]
def height_table(self):
pose = self.manipulator.listen()
return pose[2]
def borders_table(self):
p1 = self.manipulator.listen()
p2 = self.manipulator.listen()
p3 = self.manipulator.listen()
p4 = self.manipulator.listen()
return p1[:3], p2[:3], p3[:3], p4[:3]
def limb_height_table(self):
pose = self.manipulator.listen()
return pose[:3]
def robot_calibrate(limb):
"""
Calibrating limb for normal work controller.py
:param limb: aim limb for calibrate
:return: calibrated params as tuple
"""
print '__________ __'
print '\______ \_____ ___ ____/ |_ ___________'
print '| | _/\__ \ \ \/ /\ __\/ __ \_ __ \\'
print '| | \ / __ \_> < | | \ ___/| | \/'
print '|______ /(____ /__/\_ \ |__| \___ >__|'
print ' \/ \/ \/ \/'
calibrator = RobotCalibrator(limb)
print 'Calibrate your robot, follow instruction'
print 'Use WASD as Counter-Strike ;)'
print 'Use E and Q to up and down'
print 'Set up default position and press ESC'
position = calibrator.default_position()
print 'Set up height of table and press ESC'
height = calibrator.height_table()
# print 'Set up borders of the table and press ESC'
# borders = calibrator.borders_table()
print 'Set up limb height from table and press ESC'
limb_height = calibrator.limb_height_table()
return position, height, limb_height
if __name__ == '__main__':
rospy.init_node('calibrating')
result = robot_calibrate('left')