def test_init(): """Test.""" # test error with raises(PyboticsError): MDHKinematicChain(np.eye(5)) # test sequence of links MDHKinematicChain([RevoluteMDHLink()])
class UR10(Robot): """Universal Robots UR10 collaborative robot.""" # TODO: add manufacturer's joint limits kinematic_chain = MDHKinematicChain( np.array([ 0, 0, 0, 118, np.pi / 2, 0, np.pi, 0, 0, 612.7, 0, 0, 0, 571.6, 0, 163.9, -np.pi / 2, 0, 0, 115.7, np.pi / 2, 0, np.pi, 92.2 ])) def __init__(self, **kwargs: Any) -> None: """Init robot.""" super().__init__(deepcopy(self.kinematic_chain), **kwargs)
class MecademicMeca500(Robot): """Mecademic Meca500 small robot.""" # TODO: add manufacturer's joint limits kinematic_chain = MDHKinematicChain( np.array([ 0, 0, 0, 135, -np.pi / 2, 0, -np.pi / 2, 0, 0, 135, 0, 0, -np.pi / 2, 38, 0, 120, np.pi / 2, 0, 0, 0, -np.pi / 2, 0, np.pi, 72 ])) def __init__(self, **kwargs: Any) -> None: """Init robot.""" super().__init__(deepcopy(self.kinematic_chain), **kwargs)
class KukaLBRiiwa7(Robot): """KUKA LBR iiwa 7 R800 collaborative robot.""" # TODO: add manufacturer's joint limits kinematic_chain = MDHKinematicChain( np.array([ 0, 0, 0, 340, -np.pi / 2, 0, 0, 0, np.pi / 2, 0, 0, 400, np.pi / 2, 0, 0, 0, -np.pi / 2, 0, 0, 400, -np.pi / 2, 0, 0, 0, np.pi / 2, 0, 0, 126 ])) def __init__(self, **kwargs: Any) -> None: """Init robot.""" super().__init__(deepcopy(self.kinematic_chain), **kwargs)
def planar_robot(): """Generate planar robot.""" return Robot( MDHKinematicChain( np.array([[0, 0, 0, 0], [0, 10, 0, 0], [0, 20, 0, 0]])))
def test_ndof(): """Test.""" link = RevoluteMDHLink() kc = MDHKinematicChain([link]) assert kc.ndof == 1
def test_links_setter(): """Test.""" link = RevoluteMDHLink() kc = MDHKinematicChain([link]) kc.links = link
def test_to_json(): """Test.""" link = RevoluteMDHLink() kc = MDHKinematicChain([link]) kc.to_json()
def test_repr(): """Test.""" link = RevoluteMDHLink() kc = MDHKinematicChain([link]) repr(kc)
def test_vector(): """Test.""" link = RevoluteMDHLink() kc = MDHKinematicChain([link]) np.testing.assert_allclose(kc.vector, link.vector)
def test_num_parameters(): """Test.""" link = RevoluteMDHLink() kc = MDHKinematicChain([link]) assert kc.num_parameters == MDHLink._size
def from_parameters(cls, parameters: Sequence[float]) -> Sized: """Construct Robot from Kinematic Chain parameters.""" # FIXME: assumes MDH revolute robot kc = MDHKinematicChain.from_parameters(parameters) return cls(kinematic_chain=kc)