robot.py 3.13 KB
Newer Older
1
2
3
4
5
# -*- coding: utf-8 -*-
# Copyright 2016, Olivier Stasse, CNRS

from dynamic_graph.sot.talos import Talos

Guilhem Saurel's avatar
Guilhem Saurel committed
6
7

class Robot(Talos):
8
9
10
11
    """
    This class instantiates LAAS TALOS Robot
    """

Guilhem Saurel's avatar
Guilhem Saurel committed
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
    halfSitting = (
        0.0,
        0.0,
        1.018213,
        0.00,
        0.0,
        0.0,  # Free flyer
        0.0,
        0.0,
        -0.411354,
        0.859395,
        -0.448041,
        -0.001708,  # Left Leg
        0.0,
        0.0,
        -0.411354,
        0.859395,
        -0.448041,
        -0.001708,  # Right Leg
        0.0,
        0.006761,  # Chest
        0.25847,
        0.173046,
        -0.0002,
        -0.525366,
        0.0,
        -0.0,
        0.1,
        -0.005,  # Left Arm
        -0.25847,
        -0.173046,
        0.0002,
        -0.525366,
        0.0,
        0.0,
        0.1,
        -0.005,  # Right Arm
        0.,
        0.  # Head
    )
52

Guilhem Saurel's avatar
Guilhem Saurel committed
53
54
    def __init__(self, name, device=None, tracer=None):
        Talos.__init__(self, name, self.halfSitting, device, tracer)
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
        """
        TODO:Confirm these values
        # Define camera positions w.r.t gaze.
        cameraBottomLeftPosition = np.matrix((
            (0.98481, 0.00000, 0.17365, 0.035),
            (0.,      1.,      0.,      0.072),
            (-0.17365, 0.00000, 0.98481, 0.075 - 0.03),
            (0., 0., 0., 1.),
        ))
        cameraBottomRightPosition = np.matrix((
            (0.98481, 0.00000, 0.17365, 0.035),
                (0.,      1.,      0.,     -0.072),
                (-0.17365, 0.00000, 0.98481, 0.075 - 0.03),
                (0., 0., 0., 1.),
                ))
        cameraTopLeftPosition = np.matrix((
            (0.99920,  0.00120, 0.03997, 0.01),
            (0.00000,  0.99955,-0.03000, 0.029),
            (-0.03999, 0.02997, 0.99875, 0.145 - 0.03),
            (0.,       0.,      0.,      1.),
        ))
        cameraTopRightPosition = np.matrix((
            (0.99920,  0.00000, 0.03999,  0.01),
            (0.00000,  1.00000, 0.00000, -0.029),
            (-0.03999, 0.00000, 0.99920,  0.145 - 0.03),
            (0.,       0.,      0.,       1.),
        ))
Guilhem Saurel's avatar
Guilhem Saurel committed
82
        # Frames re-orientation:
83
84
85
86
87
88
89
90
91
        # Z = depth (increase from near to far)
        # X = increase from left to right
        # Y = increase from top to bottom

        c1_M_c = np.matrix(
            [[ 0.,  0.,  1., 0.],
             [-1.,  0.,  0., 0.],
             [ 0., -1.,  0., 0.],
             [ 0.,  0.,  0., 1.]])
Guilhem Saurel's avatar
Guilhem Saurel committed
92

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
        for camera in [cameraBottomLeftPosition, cameraBottomRightPosition,
                       cameraTopLeftPosition, cameraTopRightPosition]:
            camera[:] = camera * c1_M_c

        self.AdditionalFrames.append(
            ("cameraBottomLeft",
             matrixToTuple(cameraBottomLeftPosition), "gaze"))
        self.AdditionalFrames.append(
            ("cameraBottomRight",
             matrixToTuple(cameraBottomRightPosition), "gaze"))
        self.AdditionalFrames.append(
            ("cameraTopLeft",
             matrixToTuple(cameraTopLeftPosition), "gaze"))
        self.AdditionalFrames.append(
            ("cameraTopRight",
             matrixToTuple(cameraTopRightPosition), "gaze"))
        """

Guilhem Saurel's avatar
Guilhem Saurel committed
111

112
__all__ = ["Robot"]