-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhand_eye_calibration_compute.py
52 lines (38 loc) · 1.74 KB
/
hand_eye_calibration_compute.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
import cv2 as cv
import numpy as np
from utils import TripodHeads, arc, tf_get_cam_matrix, read_from_yaml
hvec = read_from_yaml('hand_eye_paraments.yaml', ['hvec'])[0]
dhpara = np.array([[arc(90), 13, 10, arc(90)],
[arc(90), 8.6, 0, arc(90)],
[0, 52, 0, 0]])
servopara = [2, [8, 7], 50, [0, 0]]
tripodheads = TripodHeads(dhpara, servopara)
handvec = []
tripodheads.servo_run([0, 1], [-15, -5])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [15, 5])
tripodheads.servo_run([0, 1], [0, 10])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [0, -10])
tripodheads.servo_run([0, 1], [10, -5])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [-10, 5])
tripodheads.servo_run([0, 1], [-15, 0])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [15, 0])
tripodheads.servo_run([0, 1], [10, 10])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [-10, -10])
tripodheads.servo_run([0, 1], [0, -5])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [0, 5])
tripodheads.servo_run([0, 1], [-15, 10])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [15, -10])
tripodheads.servo_run([0, 1], [10, 0])
handvec.append(tripodheads.dh.transformation(0, 3).astype(np.float32))
tripodheads.servo_run([0, 1], [-10, 0])
x_predict = tf_get_cam_matrix(hvec, handvec)
print(x_predict)
fs = cv.FileStorage('hand_eye_output.yaml', cv.FileStorage_WRITE)
fs.write('hand2cam', np.array(x_predict))