kinpy 0.4.2__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kinpy-0.4.3/.gitignore +5 -0
- kinpy-0.4.3/PKG-INFO +14 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/transform.py +1 -1
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/visualizer.py +1 -1
- kinpy-0.4.3/pyproject.toml +49 -0
- kinpy-0.4.2/MANIFEST.in +0 -1
- kinpy-0.4.2/PKG-INFO +0 -114
- kinpy-0.4.2/README.md +0 -95
- kinpy-0.4.2/kinpy/mjcf_parser/__init__.py +0 -1
- kinpy-0.4.2/kinpy/mjcf_parser/attribute.py +0 -479
- kinpy-0.4.2/kinpy/mjcf_parser/base.py +0 -37
- kinpy-0.4.2/kinpy/mjcf_parser/constants.py +0 -68
- kinpy-0.4.2/kinpy/mjcf_parser/copier.py +0 -73
- kinpy-0.4.2/kinpy/mjcf_parser/debugging.py +0 -376
- kinpy-0.4.2/kinpy/mjcf_parser/element.py +0 -1325
- kinpy-0.4.2/kinpy/mjcf_parser/io.py +0 -31
- kinpy-0.4.2/kinpy/mjcf_parser/namescope.py +0 -215
- kinpy-0.4.2/kinpy/mjcf_parser/parser.py +0 -210
- kinpy-0.4.2/kinpy/mjcf_parser/schema.py +0 -251
- kinpy-0.4.2/kinpy/mjcf_parser/util.py +0 -41
- kinpy-0.4.2/kinpy/urdf_parser_py/__init__.py +0 -1
- kinpy-0.4.2/kinpy/urdf_parser_py/sdf.py +0 -310
- kinpy-0.4.2/kinpy/urdf_parser_py/urdf.py +0 -592
- kinpy-0.4.2/kinpy/urdf_parser_py/xml_reflection/__init__.py +0 -1
- kinpy-0.4.2/kinpy/urdf_parser_py/xml_reflection/basics.py +0 -91
- kinpy-0.4.2/kinpy/urdf_parser_py/xml_reflection/core.py +0 -680
- kinpy-0.4.2/kinpy.egg-info/PKG-INFO +0 -114
- kinpy-0.4.2/kinpy.egg-info/SOURCES.txt +0 -42
- kinpy-0.4.2/kinpy.egg-info/dependency_links.txt +0 -1
- kinpy-0.4.2/kinpy.egg-info/requires.txt +0 -7
- kinpy-0.4.2/kinpy.egg-info/top_level.txt +0 -1
- kinpy-0.4.2/pyproject.toml +0 -36
- kinpy-0.4.2/setup.cfg +0 -4
- kinpy-0.4.2/setup.py +0 -22
- kinpy-0.4.2/tests/test_fkik.py +0 -31
- kinpy-0.4.2/tests/test_jacobian.py +0 -69
- kinpy-0.4.2/tests/test_transform.py +0 -20
- {kinpy-0.4.2 → kinpy-0.4.3}/LICENSE +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/__init__.py +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/chain.py +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/frame.py +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/ik.py +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/jacobian.py +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/mjcf.py +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/mjcf_parser/schema.xml +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/sdf.py +0 -0
- {kinpy-0.4.2 → kinpy-0.4.3}/kinpy/urdf.py +0 -0
kinpy-0.4.3/PKG-INFO
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kinpy
|
|
3
|
+
Version: 0.4.3
|
|
4
|
+
Author-email: neka-nat <nekanat.stock@gmail.com>
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: <3.14,>=3.10
|
|
8
|
+
Requires-Dist: absl-py>=0.11.0
|
|
9
|
+
Requires-Dist: lxml>=5.0.0
|
|
10
|
+
Requires-Dist: numpy>=2.0.0
|
|
11
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
12
|
+
Requires-Dist: scipy>=1.11.2
|
|
13
|
+
Requires-Dist: transformations>=2020.1.1
|
|
14
|
+
Requires-Dist: vtk>=9.0.1
|
|
@@ -10,7 +10,7 @@ class Transform:
|
|
|
10
10
|
Attributes
|
|
11
11
|
----------
|
|
12
12
|
rot : np.ndarray
|
|
13
|
-
The rotation parameter. Give in quaternions or roll pitch yaw.
|
|
13
|
+
The rotation parameter (scalar-first quaternion). Give in quaternions or roll pitch yaw.
|
|
14
14
|
pos : np.ndarray
|
|
15
15
|
The translation parameter.
|
|
16
16
|
"""
|
|
@@ -228,7 +228,7 @@ class JointAngleEditor(Visualizer):
|
|
|
228
228
|
slider_rep = vtk.vtkSliderRepresentation2D()
|
|
229
229
|
slider_rep.SetMinimumValue(-180)
|
|
230
230
|
slider_rep.SetMaximumValue(180)
|
|
231
|
-
slider_rep.SetValue(np.rad2deg(self._joint_angles
|
|
231
|
+
slider_rep.SetValue(np.rad2deg(self._joint_angles.get(frame.joint.name, 0.0)))
|
|
232
232
|
slider_rep.SetSliderLength(0.05)
|
|
233
233
|
slider_rep.SetSliderWidth(0.02)
|
|
234
234
|
slider_rep.SetEndCapLength(0.01)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "kinpy"
|
|
3
|
+
version = "0.4.3"
|
|
4
|
+
description = ""
|
|
5
|
+
authors = [{ name = "neka-nat", email = "nekanat.stock@gmail.com" }]
|
|
6
|
+
requires-python = ">=3.10,<3.14"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"numpy>=2.0.0",
|
|
10
|
+
"scipy>=1.11.2",
|
|
11
|
+
"transformations>=2020.1.1",
|
|
12
|
+
"absl-py>=0.11.0",
|
|
13
|
+
"lxml>=5.0.0",
|
|
14
|
+
"PyYAML>=6.0.1",
|
|
15
|
+
"vtk>=9.0.1",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[dependency-groups]
|
|
19
|
+
dev = [
|
|
20
|
+
"isort>=5.9.3,<6",
|
|
21
|
+
"black>=22.6.0,<23",
|
|
22
|
+
"flake8>=5.0.4,<6",
|
|
23
|
+
"flake8-bugbear>=22.8.23,<23",
|
|
24
|
+
"flake8-simplify>=0.19.3,<0.20",
|
|
25
|
+
"mypy>=1.0.1,<2",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["hatchling"]
|
|
30
|
+
build-backend = "hatchling.build"
|
|
31
|
+
|
|
32
|
+
[tool.hatch.build]
|
|
33
|
+
include = [
|
|
34
|
+
"kinpy/**.py",
|
|
35
|
+
"kinpy/mjcf_parser/schema.xml",
|
|
36
|
+
]
|
|
37
|
+
exclude = [
|
|
38
|
+
"/tests/**",
|
|
39
|
+
"/examples/**",
|
|
40
|
+
"/scripts/**",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[tool.hatch.build.targets.wheel]
|
|
44
|
+
packages = ["kinpy"]
|
|
45
|
+
force-include = { "kinpy/mjcf_parser/schema.xml" = "kinpy/mjcf_parser/schema.xml" }
|
|
46
|
+
|
|
47
|
+
[tool.mypy]
|
|
48
|
+
python_version = "3.10"
|
|
49
|
+
ignore_missing_imports = true
|
kinpy-0.4.2/MANIFEST.in
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
include kinpy/mjcf_parser/schema.xml
|
kinpy-0.4.2/PKG-INFO
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: kinpy
|
|
3
|
-
Version: 0.4.2
|
|
4
|
-
Summary: Robotics kinematic calculation toolkit
|
|
5
|
-
Home-page: http://github.com/neka-nat/kinpy
|
|
6
|
-
Author: neka-nat
|
|
7
|
-
Author-email: nekanat.stock@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Keywords: robot kinematics
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: numpy
|
|
13
|
-
Requires-Dist: scipy
|
|
14
|
-
Requires-Dist: absl-py
|
|
15
|
-
Requires-Dist: pyyaml
|
|
16
|
-
Requires-Dist: lxml
|
|
17
|
-
Requires-Dist: transformations
|
|
18
|
-
Requires-Dist: vtk
|
|
19
|
-
|
|
20
|
-
# <img src="https://raw.githubusercontent.com/neka-nat/kinpy/master/assets/logo.png" width="400" />
|
|
21
|
-
|
|
22
|
-
[](https://github.com/neka-nat/kinpy/actions/workflows/ubuntu.yml/badge.svg)
|
|
23
|
-
[](https://badge.fury.io/py/kinpy)
|
|
24
|
-
[](LICENSE)
|
|
25
|
-
[](https://pepy.tech/project/kinpy)
|
|
26
|
-
|
|
27
|
-
Simple kinematics body toolkit.
|
|
28
|
-
|
|
29
|
-
## Core features
|
|
30
|
-
|
|
31
|
-
* Pure python library.
|
|
32
|
-
* Support URDF, SDF and MJCF file.
|
|
33
|
-
* Calculate FK, IK and jacobian.
|
|
34
|
-
|
|
35
|
-

|
|
36
|
-
|
|
37
|
-
## Installation
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
pip install kinpy
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Getting started
|
|
44
|
-
Here is a program that reads urdf and generates a kinematic chain.
|
|
45
|
-
|
|
46
|
-
```py
|
|
47
|
-
import kinpy as kp
|
|
48
|
-
|
|
49
|
-
chain = kp.build_chain_from_urdf(open("kuka_iiwa/model.urdf").read())
|
|
50
|
-
print(chain)
|
|
51
|
-
# lbr_iiwa_link_0_frame
|
|
52
|
-
# └──── lbr_iiwa_link_1_frame
|
|
53
|
-
# └──── lbr_iiwa_link_2_frame
|
|
54
|
-
# └──── lbr_iiwa_link_3_frame
|
|
55
|
-
# └──── lbr_iiwa_link_4_frame
|
|
56
|
-
# └──── lbr_iiwa_link_5_frame
|
|
57
|
-
# └──── lbr_iiwa_link_6_frame
|
|
58
|
-
# └──── lbr_iiwa_link_7_frame
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Displays the parameter names of joint angles included in the chain.
|
|
62
|
-
|
|
63
|
-
```py
|
|
64
|
-
print(chain.get_joint_parameter_names())
|
|
65
|
-
# ['lbr_iiwa_joint_1', 'lbr_iiwa_joint_2', 'lbr_iiwa_joint_3', 'lbr_iiwa_joint_4', 'lbr_iiwa_joint_5', 'lbr_iiwa_joint_6', 'lbr_iiwa_joint_7']
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Given joint angle values, calculate forward kinematics.
|
|
69
|
-
|
|
70
|
-
```py
|
|
71
|
-
import math
|
|
72
|
-
th = {'lbr_iiwa_joint_2': math.pi / 4.0, 'lbr_iiwa_joint_4': math.pi / 2.0}
|
|
73
|
-
ret = chain.forward_kinematics(th)
|
|
74
|
-
# {'lbr_iiwa_link_0': Transform(rot=[1. 0. 0. 0.], pos=[0. 0. 0.]), 'lbr_iiwa_link_1': Transform(rot=[1. 0. 0. 0.], pos=[0. 0. 0.1575]), 'lbr_iiwa_link_2': Transform(rot=[-0.27059805 0.27059805 0.65328148 0.65328148], pos=[0. 0. 0.36]), 'lbr_iiwa_link_3': Transform(rot=[-9.23879533e-01 3.96044251e-14 -3.82683432e-01 -1.96942462e-12], pos=[ 1.44603337e-01 -6.78179735e-13 5.04603337e-01]), 'lbr_iiwa_link_4': Transform(rot=[-0.65328148 -0.65328148 0.27059805 -0.27059805], pos=[ 2.96984848e-01 -3.37579445e-13 6.56984848e-01]), 'lbr_iiwa_link_5': Transform(rot=[ 2.84114655e-12 3.82683432e-01 -1.87377891e-12 -9.23879533e-01], pos=[ 1.66523647e-01 -1.00338887e-12 7.87446049e-01]), 'lbr_iiwa_link_6': Transform(rot=[-0.27059805 0.27059805 -0.65328148 -0.65328148], pos=[ 1.41421356e-02 -7.25873884e-13 9.39827561e-01]), 'lbr_iiwa_link_7': Transform(rot=[ 9.23879533e-01 2.61060896e-12 -3.82683432e-01 4.81056861e-12], pos=[-4.31335137e-02 -1.01819561e-12 9.97103210e-01])}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
You can get the position and orientation of each link.
|
|
78
|
-
|
|
79
|
-
If you want to use IK or Jacobian, you need to create a `SerialChain`.
|
|
80
|
-
When creating a `SerialChain`, an end effector must be specified.
|
|
81
|
-
|
|
82
|
-
```py
|
|
83
|
-
chain = kp.build_serial_chain_from_urdf(open("kuka_iiwa/model.urdf"), "lbr_iiwa_link_7")
|
|
84
|
-
th = [0.0, -math.pi / 4.0, 0.0, math.pi / 2.0, 0.0, math.pi / 4.0, 0.0]
|
|
85
|
-
ret = chain.forward_kinematics(th, end_only=True)
|
|
86
|
-
# chain.inverse_kinematics(ret)
|
|
87
|
-
# chain.jacobian(th)
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Visualization
|
|
91
|
-
|
|
92
|
-
### KUKA IIWA
|
|
93
|
-

|
|
94
|
-
|
|
95
|
-
### Mujoco humanoid
|
|
96
|
-

|
|
97
|
-
|
|
98
|
-
### Mujoco ant
|
|
99
|
-

|
|
100
|
-
|
|
101
|
-
### Simple arm
|
|
102
|
-

|
|
103
|
-
|
|
104
|
-
## Citing
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
@software{kinpy,
|
|
108
|
-
author = {{Kenta-Tanaka et al.}},
|
|
109
|
-
title = {kinpy},
|
|
110
|
-
url = {https://github.com/neka-nat/kinpy},
|
|
111
|
-
version = {0.0.3},
|
|
112
|
-
date = {2019-10-11},
|
|
113
|
-
}
|
|
114
|
-
```
|
kinpy-0.4.2/README.md
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# <img src="https://raw.githubusercontent.com/neka-nat/kinpy/master/assets/logo.png" width="400" />
|
|
2
|
-
|
|
3
|
-
[](https://github.com/neka-nat/kinpy/actions/workflows/ubuntu.yml/badge.svg)
|
|
4
|
-
[](https://badge.fury.io/py/kinpy)
|
|
5
|
-
[](LICENSE)
|
|
6
|
-
[](https://pepy.tech/project/kinpy)
|
|
7
|
-
|
|
8
|
-
Simple kinematics body toolkit.
|
|
9
|
-
|
|
10
|
-
## Core features
|
|
11
|
-
|
|
12
|
-
* Pure python library.
|
|
13
|
-
* Support URDF, SDF and MJCF file.
|
|
14
|
-
* Calculate FK, IK and jacobian.
|
|
15
|
-
|
|
16
|
-

|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
pip install kinpy
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Getting started
|
|
25
|
-
Here is a program that reads urdf and generates a kinematic chain.
|
|
26
|
-
|
|
27
|
-
```py
|
|
28
|
-
import kinpy as kp
|
|
29
|
-
|
|
30
|
-
chain = kp.build_chain_from_urdf(open("kuka_iiwa/model.urdf").read())
|
|
31
|
-
print(chain)
|
|
32
|
-
# lbr_iiwa_link_0_frame
|
|
33
|
-
# └──── lbr_iiwa_link_1_frame
|
|
34
|
-
# └──── lbr_iiwa_link_2_frame
|
|
35
|
-
# └──── lbr_iiwa_link_3_frame
|
|
36
|
-
# └──── lbr_iiwa_link_4_frame
|
|
37
|
-
# └──── lbr_iiwa_link_5_frame
|
|
38
|
-
# └──── lbr_iiwa_link_6_frame
|
|
39
|
-
# └──── lbr_iiwa_link_7_frame
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Displays the parameter names of joint angles included in the chain.
|
|
43
|
-
|
|
44
|
-
```py
|
|
45
|
-
print(chain.get_joint_parameter_names())
|
|
46
|
-
# ['lbr_iiwa_joint_1', 'lbr_iiwa_joint_2', 'lbr_iiwa_joint_3', 'lbr_iiwa_joint_4', 'lbr_iiwa_joint_5', 'lbr_iiwa_joint_6', 'lbr_iiwa_joint_7']
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Given joint angle values, calculate forward kinematics.
|
|
50
|
-
|
|
51
|
-
```py
|
|
52
|
-
import math
|
|
53
|
-
th = {'lbr_iiwa_joint_2': math.pi / 4.0, 'lbr_iiwa_joint_4': math.pi / 2.0}
|
|
54
|
-
ret = chain.forward_kinematics(th)
|
|
55
|
-
# {'lbr_iiwa_link_0': Transform(rot=[1. 0. 0. 0.], pos=[0. 0. 0.]), 'lbr_iiwa_link_1': Transform(rot=[1. 0. 0. 0.], pos=[0. 0. 0.1575]), 'lbr_iiwa_link_2': Transform(rot=[-0.27059805 0.27059805 0.65328148 0.65328148], pos=[0. 0. 0.36]), 'lbr_iiwa_link_3': Transform(rot=[-9.23879533e-01 3.96044251e-14 -3.82683432e-01 -1.96942462e-12], pos=[ 1.44603337e-01 -6.78179735e-13 5.04603337e-01]), 'lbr_iiwa_link_4': Transform(rot=[-0.65328148 -0.65328148 0.27059805 -0.27059805], pos=[ 2.96984848e-01 -3.37579445e-13 6.56984848e-01]), 'lbr_iiwa_link_5': Transform(rot=[ 2.84114655e-12 3.82683432e-01 -1.87377891e-12 -9.23879533e-01], pos=[ 1.66523647e-01 -1.00338887e-12 7.87446049e-01]), 'lbr_iiwa_link_6': Transform(rot=[-0.27059805 0.27059805 -0.65328148 -0.65328148], pos=[ 1.41421356e-02 -7.25873884e-13 9.39827561e-01]), 'lbr_iiwa_link_7': Transform(rot=[ 9.23879533e-01 2.61060896e-12 -3.82683432e-01 4.81056861e-12], pos=[-4.31335137e-02 -1.01819561e-12 9.97103210e-01])}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
You can get the position and orientation of each link.
|
|
59
|
-
|
|
60
|
-
If you want to use IK or Jacobian, you need to create a `SerialChain`.
|
|
61
|
-
When creating a `SerialChain`, an end effector must be specified.
|
|
62
|
-
|
|
63
|
-
```py
|
|
64
|
-
chain = kp.build_serial_chain_from_urdf(open("kuka_iiwa/model.urdf"), "lbr_iiwa_link_7")
|
|
65
|
-
th = [0.0, -math.pi / 4.0, 0.0, math.pi / 2.0, 0.0, math.pi / 4.0, 0.0]
|
|
66
|
-
ret = chain.forward_kinematics(th, end_only=True)
|
|
67
|
-
# chain.inverse_kinematics(ret)
|
|
68
|
-
# chain.jacobian(th)
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Visualization
|
|
72
|
-
|
|
73
|
-
### KUKA IIWA
|
|
74
|
-

|
|
75
|
-
|
|
76
|
-
### Mujoco humanoid
|
|
77
|
-

|
|
78
|
-
|
|
79
|
-
### Mujoco ant
|
|
80
|
-

|
|
81
|
-
|
|
82
|
-
### Simple arm
|
|
83
|
-

|
|
84
|
-
|
|
85
|
-
## Citing
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
@software{kinpy,
|
|
89
|
-
author = {{Kenta-Tanaka et al.}},
|
|
90
|
-
title = {kinpy},
|
|
91
|
-
url = {https://github.com/neka-nat/kinpy},
|
|
92
|
-
version = {0.0.3},
|
|
93
|
-
date = {2019-10-11},
|
|
94
|
-
}
|
|
95
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .parser import *
|