Exemplo n.º 1
0
 def createOpPointModif(self):
     self.opPointModif = OpPointModifier('opmodif' + self.name)
     plug(self.dyn.signal(self.opPoint),
          self.opPointModif.signal('positionIN'))
     plug(self.dyn.signal('J' + self.opPoint),
          self.opPointModif.signal('jacobianIN'))
     self.opPointModif.activ = False
 def createOpPointModifBase(self):
     self.opPointModifBase = OpPointModifier('opmodifBase' + self.name)
     plug(self.dyn.signal(self.opPointBase),
          self.opPointModifBase.signal('positionIN'))
     plug(self.dyn.signal('J' + self.opPointBase),
          self.opPointModifBase.signal('jacobianIN'))
     self.opPointModifBase.activ = False
Exemplo n.º 3
0
    def test_rotation(self):
        T = np.array(((0., 0., 1., 0.), (0., -1., 0., 0.), (1., 0., 0., 0.),
                      (0., 0., 0., 1.)))

        op = OpPointModifier('op3')
        op.setTransformation(T)
        op.positionIN.value = gaze
        op.jacobianIN.value = Jgaze
        op.position.recompute(1)
        op.jacobian.recompute(1)

        self.assertTrue((op.getTransformation() == T).all())

        # w_M_s = w_M_g * g_M_s
        w_M_g = gaze
        g_M_s = T
        w_M_s_ref = w_M_g.dot(g_M_s)
        w_M_s = op.position.value

        # Check w_M_s == w_M_s_ref
        self.assertTrue((w_M_s == w_M_s_ref).all())

        twist = np.array([[0., 0., 1., 0., 0., 0.], [0., -1., 0., 0., 0., 0.],
                          [1., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 1.],
                          [0., 0., 0., 0., -1., 0.], [0., 0., 0., 1., 0., 0.]])

        J = op.jacobian.value
        J_ref = twist.dot(Jgaze)

        # Check w_M_s == w_M_s_ref
        self.assertTrue((J == J_ref).all())
Exemplo n.º 4
0
    def test_rotation(self):
        T = ((0., 0., 1., 0.), (0., -1., 0., 0.), (1., 0., 0., 0.), (0., 0.,
                                                                     0., 1.))

        op = OpPointModifier('op3')
        op.setTransformation(T)
        op.positionIN.value = gaze
        op.jacobianIN.value = Jgaze
        op.position.recompute(1)
        op.jacobian.recompute(1)

        self.assertEqual(op.getTransformation(), T)

        # w_M_s = w_M_g * g_M_s
        w_M_g = np.asmatrix(gaze)
        g_M_s = np.asmatrix(T)
        w_M_s_ref = w_M_g * g_M_s
        w_M_s = np.asmatrix(op.position.value)

        # Check w_M_s == w_M_s_ref
        self.assertEqual(np.equal(w_M_s, w_M_s_ref).all(), True)

        twist = np.matrix([[0., 0., 1., 0., 0., 0.], [0., -1., 0., 0., 0., 0.],
                           [1., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 1.],
                           [0., 0., 0., 0., -1., 0.], [0., 0., 0., 1., 0.,
                                                       0.]])

        J = np.asmatrix(op.jacobian.value)
        J_ref = twist * Jgaze

        # Check w_M_s == w_M_s_ref
        self.assertEqual(np.equal(J, J_ref).all(), True)
Exemplo n.º 5
0
    def test_translation(self):
        tx = 11.
        ty = 22.
        tz = 33.

        T = np.array(((1., 0., 0., tx), (0., 1., 0., ty), (0., 0., 1., tz),
                      (0., 0., 0., 1.)))

        op = OpPointModifier('op2')
        op.setTransformation(T)
        op.positionIN.value = gaze
        op.jacobianIN.value = Jgaze
        op.position.recompute(1)
        op.jacobian.recompute(1)

        self.assertTrue((op.getTransformation() == T).all())

        # w_M_s = w_M_g * g_M_s
        w_M_g = gaze
        g_M_s = T
        w_M_s_ref = w_M_g.dot(g_M_s)
        w_M_s = op.position.value

        # Check w_M_s == w_M_s_ref
        self.assertTrue((w_M_s == w_M_s_ref).all())

        twist = np.array([[1., 0., 0., 0., tz, -ty], [0., 1., 0., -tz, 0., tx],
                          [0., 0., 1., ty, -tx, 0.], [0., 0., 0., 1., 0., 0.],
                          [0., 0., 0., 0., 1., 0.], [0., 0., 0., 0., 0., 1.]])

        J = op.jacobian.value
        J_ref = twist.dot(Jgaze)

        # Check w_M_s == w_M_s_ref
        self.assertTrue((J == J_ref).all())
Exemplo n.º 6
0
 def createFrame(self, frameName, transformation, operationalPoint):
     frame = OpPointModifier(frameName)
     frame.setTransformation(transformation)
     plug(self.dynamic.signal(operationalPoint), frame.positionIN)
     plug(self.dynamic.signal("J{0}".format(operationalPoint)), frame.jacobianIN)
     frame.position.recompute(frame.position.time + 1)
     frame.jacobian.recompute(frame.jacobian.time + 1)
     return frame
Exemplo n.º 7
0
    def test_simple(self):
        op = OpPointModifier('op')
        op.setTransformation(I4)
        op.positionIN.value = I4
        op.jacobianIN.value = I6
        op.position.recompute(0)
        op.jacobian.recompute(0)

        self.assertEqual(op.getTransformation(), I4)
        self.assertEqual(op.position.value, I4)
        self.assertEqual(op.jacobian.value, I6)
Exemplo n.º 8
0
    def test_simple(self):
        op = OpPointModifier('op')
        op.setTransformation(I4)
        op.positionIN.value = I4
        op.jacobianIN.value = I6
        op.position.recompute(0)
        op.jacobian.recompute(0)

        self.assertTrue((op.getTransformation() == I4).all())
        self.assertTrue((op.position.value == I4).all())
        self.assertTrue((op.jacobian.value == I6).all())
Exemplo n.º 9
0
    def test_translation(self):
        tx = 11.
        ty = 22.
        tz = 33.

        T = ((1., 0., 0., tx), (0., 1., 0., ty), (0., 0., 1., tz), (0., 0., 0.,
                                                                    1.))

        op = OpPointModifier('op2')
        op.setTransformation(T)
        op.positionIN.value = gaze
        op.jacobianIN.value = Jgaze
        op.position.recompute(1)
        op.jacobian.recompute(1)

        self.assertEqual(op.getTransformation(), T)

        # w_M_s = w_M_g * g_M_s
        w_M_g = np.asmatrix(gaze)
        g_M_s = np.asmatrix(T)
        w_M_s_ref = w_M_g * g_M_s
        w_M_s = np.asmatrix(op.position.value)

        # Check w_M_s == w_M_s_ref
        self.assertEqual(np.equal(w_M_s, w_M_s_ref).all(), True)

        twist = np.matrix([[1., 0., 0., 0., tz,
                            -ty], [0., 1., 0., -tz, 0., tx],
                           [0., 0., 1., ty, -tx, 0.], [0., 0., 0., 1., 0., 0.],
                           [0., 0., 0., 0., 1., 0.], [0., 0., 0., 0., 0., 1.]])

        J = np.asmatrix(op.jacobian.value)
        J_ref = twist * Jgaze

        # Check w_M_s == w_M_s_ref
        self.assertEqual(np.equal(J, J_ref).all(), True)