def test_pose(self):
t = Pose(
position=Point(1.0, 2.0, 3.0),
orientation=Quaternion(*transformations.quaternion_from_euler(np.pi, 0, 0))
)
t_mat = ros_numpy.numpify(t)
np.testing.assert_allclose(t_mat.dot([0, 0, 1, 1]), [1.0, 2.0, 2.0, 1.0])
msg = ros_numpy.msgify(Pose, t_mat)
np.testing.assert_allclose(msg.position.x, t.position.x)
np.testing.assert_allclose(msg.position.y, t.position.y)
np.testing.assert_allclose(msg.position.z, t.position.z)
np.testing.assert_allclose(msg.orientation.x, t.orientation.x)
np.testing.assert_allclose(msg.orientation.y, t.orientation.y)
np.testing.assert_allclose(msg.orientation.z, t.orientation.z)
np.testing.assert_allclose(msg.orientation.w, t.orientation.w)
评论列表
文章目录