|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +import numpy as np |
| 4 | +from roboticstoolbox.robot.ERobot import ERobot |
| 5 | +from math import pi |
| 6 | + |
| 7 | + |
| 8 | +class Z1(ERobot): |
| 9 | + """ |
| 10 | + Class that imports a Z1 URDF model |
| 11 | + ``Z1()`` is a class which imports a Unitree Z1 robot |
| 12 | + definition from a URDF file. The model describes its kinematic and |
| 13 | + graphical characteristics. |
| 14 | + .. runblock:: pycon |
| 15 | + >>> import roboticstoolbox as rtb |
| 16 | + >>> robot = rtb.models.URDF.Z1() |
| 17 | + >>> print(robot) |
| 18 | + Defined joint configurations are: |
| 19 | + - qz, zero joint angle configuration, 'L' shaped configuration |
| 20 | + - qr, vertical 'READY' configuration |
| 21 | + .. codeauthor:: Keith Siilats |
| 22 | + .. sectionauthor:: Peter Corke |
| 23 | + """ |
| 24 | + |
| 25 | + def __init__(self): |
| 26 | + |
| 27 | + links, name, urdf_string, urdf_filepath = self.URDF_read( |
| 28 | + "z1_description/xacro/robot.xacro" |
| 29 | + ) |
| 30 | + # for link in links: |
| 31 | + # print(link) |
| 32 | + |
| 33 | + super().__init__( |
| 34 | + links, |
| 35 | + name=name.upper(), |
| 36 | + manufacturer="Unitree", |
| 37 | + # gripper_links=links[9], |
| 38 | + urdf_string=urdf_string, |
| 39 | + urdf_filepath=urdf_filepath, |
| 40 | + ) |
| 41 | + # forward, -0.000019, 1.542859, -1.037883, -0.531308, 0.002487, -0.012173, 0.999650, -0.002146, -0.026357, 0.389527, 0.002468, 0.999923, 0.012173, 0.000269, 0.026329, -0.012234, 0.999578, 0.402549, 0.000000, 0.000000, 0.000000, 1.000000, |
| 42 | + # start, -0.000336, 0.001634, 0.000000, 0.064640, 0.000248, 0.000230, 0.997805, 0.000104, 0.066225, 0.048696, -0.000087, 1.000000, -0.000252, 0.000011, -0.066225, 0.000246, 0.997805, 0.148729, 0.000000, 0.000000, 0.000000, 1.000000, |
| 43 | + |
| 44 | + self.qr = np.array([0.000922, 0.000680, -0.003654, -0.075006, -0.000130, 0.000035,0]) |
| 45 | + self.qz = np.array([0.000922, 0.000680, -0.003654, -0.075006, -0.000130, 0.000035,0]) |
| 46 | + self.grab3 = np.array([-0.247,1.271, -1.613, -0.267, -0.617,0.916,0]) |
| 47 | + |
| 48 | + |
| 49 | + self.addconfiguration("qr", self.qr) |
| 50 | + self.addconfiguration("qz", self.qz) |
| 51 | + self.addconfiguration("grab3", self.grab3) |
| 52 | + |
| 53 | + # sol=robot.ikine_LM(SE3(0.5, -0.2, 0.2)@SE3.OA([1,0,0],[0,0,-1])) |
| 54 | + # 0, 0.000922, 0.000680, -0.003654, -0.075006, -0.000130, 0.000035, 0.000006, -0.002146, -0.002523, -0.003688, -0.002988, -0.000048, 0.001385, 0.016346, |
| 55 | + self.addconfiguration_attr( |
| 56 | + "qn", |
| 57 | + np.array( |
| 58 | + [0.000922, 0.000680, -0.003654, -0.075006, -0.000130, 0.000035,0] |
| 59 | + ), |
| 60 | + ) |
| 61 | + self.addconfiguration_attr("q1", [0.000922, 0.000680, -0.003654, -0.075006, -0.000130, 0.000035,0]) |
| 62 | + |
| 63 | + |
| 64 | +if __name__ == "__main__": # pragma nocover |
| 65 | + |
| 66 | + robot = Z1() |
| 67 | + print(robot) |
| 68 | + print(robot.ets()) |
| 69 | + print(robot.fkine(q=np.ones(6))) |
0 commit comments