示例#1
0
文件: rpy.py 项目: nim65s/pinocchio
 def test_rotate(self):
     self.assertApprox(rotate('x', pi / 2), np.matrix('1. 0. 0.;0. 0. -1.;0. 1. 0.'))
     self.assertApprox(rotate('x', pi) * rotate('y', pi), rotate('z', pi))
     m = rotate('x', pi / 3) * rotate('y', pi / 5) * rotate('y', pi / 7)
     self.assertApprox(rpyToMatrix(matrixToRpy(m)), m)
     rpy = np.matrix(list(range(3))).T * pi / 2
     self.assertApprox(matrixToRpy(rpyToMatrix(rpy)), rpy)
示例#2
0
 def test_rotate(self):
     self.assertApprox(rotate('x', pi / 2),
                       np.matrix('1. 0. 0.;0. 0. -1.;0. 1. 0.'))
     self.assertApprox(rotate('x', pi) * rotate('y', pi), rotate('z', pi))
     m = rotate('x', pi / 3) * rotate('y', pi / 5) * rotate('y', pi / 7)
     self.assertApprox(rpyToMatrix(matrixToRpy(m)), m)
     rpy = np.matrix(list(range(3))).T * pi / 2
     self.assertApprox(matrixToRpy(rpyToMatrix(rpy)), rpy)
示例#3
0
文件: rpy.py 项目: zeta1999/pinocchio
 def test_rotate(self):
     self.assertApprox(rotate('x', pi / 2), np.array([[1., 0., 0.],[0., 0., -1.],[0., 1., 0.]]))
     self.assertApprox(rotate('x', pi).dot(rotate('y', pi)), rotate('z', pi))
     m = rotate('x', pi / 3).dot(rotate('y', pi / 5)).dot(rotate('y', pi / 7))
     self.assertApprox(rpyToMatrix(matrixToRpy(m)), m)
     rpy = np.array(list(range(3))) * pi / 2
     self.assertApprox(matrixToRpy(rpyToMatrix(rpy)), rpy)
     self.assertApprox(rpyToMatrix(rpy), rpyToMatrix(float(rpy[0]), float(rpy[1]), float(rpy[2])))
示例#4
0
    def test_rotate(self):
        self.assertApprox(
            rotate('x', pi / 2),
            np.array([[1., 0., 0.], [0., 0., -1.], [0., 1., 0.]]))
        self.assertApprox(
            rotate('x', pi).dot(rotate('y', pi)), rotate('z', pi))
        m = rotate('x', pi / 3).dot(rotate('y',
                                           pi / 5)).dot(rotate('y', pi / 7))
        self.assertApprox(rpyToMatrix(matrixToRpy(m)), m)
        rpy = np.array(list(range(3))) * pi / 2
        self.assertApprox(matrixToRpy(rpyToMatrix(rpy)), rpy)
        self.assertApprox(
            rpyToMatrix(rpy),
            rpyToMatrix(float(rpy[0]), float(rpy[1]), float(rpy[2])))

        try:
            rotate('toto', 10.)
        except ValueError:
            self.assertTrue(True)
        else:
            self.assertTrue(False)

        try:
            rotate('w', 10.)
        except ValueError:
            self.assertTrue(True)
        else:
            self.assertTrue(False)