ikpy 4.4.2__tar.gz → 4.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.
Files changed (50) hide show
  1. {ikpy-4.4.2 → ikpy-4.4.3}/PKG-INFO +1 -1
  2. ikpy-4.4.3/src/ikpy/_version.py +1 -0
  3. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/chain.py +1 -1
  4. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/utils/geometry.py +4 -2
  5. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy.egg-info/PKG-INFO +1 -1
  6. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy.egg-info/SOURCES.txt +2 -0
  7. ikpy-4.4.3/tests/test_chain_concat_masks.py +50 -0
  8. ikpy-4.4.3/tests/test_translation_default.py +22 -0
  9. ikpy-4.4.2/src/ikpy/_version.py +0 -1
  10. {ikpy-4.4.2 → ikpy-4.4.3}/LICENSE +0 -0
  11. {ikpy-4.4.2 → ikpy-4.4.3}/README.md +0 -0
  12. {ikpy-4.4.2 → ikpy-4.4.3}/pyproject.toml +0 -0
  13. {ikpy-4.4.2 → ikpy-4.4.3}/setup.cfg +0 -0
  14. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/__init__.py +0 -0
  15. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/bvh/BVH.py +0 -0
  16. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/bvh/__init__.py +0 -0
  17. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/inverse_kinematics.py +0 -0
  18. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/jax_backend.py +0 -0
  19. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/link.py +0 -0
  20. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/logs.py +0 -0
  21. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/mjcf/MJCF.py +0 -0
  22. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/mjcf/__init__.py +0 -0
  23. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/mjcf/utils.py +0 -0
  24. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/selection.py +0 -0
  25. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/urdf/URDF.py +0 -0
  26. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/urdf/__init__.py +0 -0
  27. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/urdf/utils.py +0 -0
  28. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/utils/__init__.py +0 -0
  29. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/utils/jax_geometry.py +0 -0
  30. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy/utils/plot.py +0 -0
  31. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy.egg-info/dependency_links.txt +0 -0
  32. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy.egg-info/requires.txt +0 -0
  33. {ikpy-4.4.2 → ikpy-4.4.3}/src/ikpy.egg-info/top_level.txt +0 -0
  34. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_bvh.py +0 -0
  35. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_chain.py +0 -0
  36. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_chain_dh.py +0 -0
  37. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_chain_selection.py +0 -0
  38. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_ik_bounds.py +0 -0
  39. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_ik_multistart.py +0 -0
  40. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_ik_trajectory.py +0 -0
  41. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_jax_backend.py +0 -0
  42. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_mjcf.py +0 -0
  43. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_orientation.py +0 -0
  44. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_orientation_conversions.py +0 -0
  45. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_poppy_robots.py +0 -0
  46. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_transformation_roundtrip.py +0 -0
  47. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_urdf.py +0 -0
  48. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_urdf_continuous.py +0 -0
  49. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_urdf_default_axis.py +0 -0
  50. {ikpy-4.4.2 → ikpy-4.4.3}/tests/test_urdf_kdl.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ikpy
3
- Version: 4.4.2
3
+ Version: 4.4.3
4
4
  Summary: An inverse kinematics library aiming performance and modularity
5
5
  Home-page: https://github.com/Phylliade/ikpy
6
6
  Classifier: Programming Language :: Python :: 3
@@ -0,0 +1 @@
1
+ __version__ = '4.4.3'
@@ -943,4 +943,4 @@ class Chain:
943
943
  @classmethod
944
944
  def concat(cls, chain1, chain2):
945
945
  """Concatenate two chains"""
946
- return cls(links=chain1.links + chain2.links, active_links_mask=chain1.active_links_mask + chain2.active_links_mask)
946
+ return cls(links=chain1.links + chain2.links, active_links_mask=np.concatenate((chain1.active_links_mask, chain2.active_links_mask)))
@@ -106,7 +106,7 @@ def from_transformation_matrix(transformation_matrix):
106
106
  return transformation_matrix[:-1, -1], transformation_matrix[:-1, :-1]
107
107
 
108
108
 
109
- def to_transformation_matrix(translation, orientation_matrix=np.zeros((3, 3))):
109
+ def to_transformation_matrix(translation, orientation_matrix=None):
110
110
  """Convert a tuple (translation_vector, orientation_matrix) to a transformation matrix
111
111
 
112
112
  Parameters
@@ -115,10 +115,12 @@ def to_transformation_matrix(translation, orientation_matrix=np.zeros((3, 3))):
115
115
  The translation of your frame presented as a 3D vector.
116
116
  orientation_matrix: numpy.array
117
117
  Optional : The orientation of your frame, presented as a 3x3 matrix.
118
+ Defaults to the identity rotation.
118
119
  """
119
120
  matrix = np.eye(4)
120
121
 
121
- matrix[:-1, :-1] = orientation_matrix
122
+ if orientation_matrix is not None:
123
+ matrix[:-1, :-1] = orientation_matrix
122
124
  matrix[:-1, -1] = translation
123
125
  return matrix
124
126
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ikpy
3
- Version: 4.4.2
3
+ Version: 4.4.3
4
4
  Summary: An inverse kinematics library aiming performance and modularity
5
5
  Home-page: https://github.com/Phylliade/ikpy
6
6
  Classifier: Programming Language :: Python :: 3
@@ -29,6 +29,7 @@ src/ikpy/utils/jax_geometry.py
29
29
  src/ikpy/utils/plot.py
30
30
  tests/test_bvh.py
31
31
  tests/test_chain.py
32
+ tests/test_chain_concat_masks.py
32
33
  tests/test_chain_dh.py
33
34
  tests/test_chain_selection.py
34
35
  tests/test_ik_bounds.py
@@ -40,6 +41,7 @@ tests/test_orientation.py
40
41
  tests/test_orientation_conversions.py
41
42
  tests/test_poppy_robots.py
42
43
  tests/test_transformation_roundtrip.py
44
+ tests/test_translation_default.py
43
45
  tests/test_urdf.py
44
46
  tests/test_urdf_continuous.py
45
47
  tests/test_urdf_default_axis.py
@@ -0,0 +1,50 @@
1
+ import numpy as np
2
+ import pytest
3
+ from ikpy.chain import Chain
4
+ from ikpy.link import URDFLink
5
+
6
+
7
+ def make_chain(prefix, mask):
8
+ links = [
9
+ URDFLink(
10
+ name=prefix + str(i),
11
+ origin_translation=[0, 0, 1],
12
+ origin_orientation=[0, 0, 0],
13
+ rotation=[0, 0, 1],
14
+ use_symbolic_matrix=False,
15
+ )
16
+ for i in range(len(mask))
17
+ ]
18
+ return Chain(links, active_links_mask=mask)
19
+
20
+
21
+ @pytest.mark.parametrize(
22
+ "left,right",
23
+ [
24
+ ([True, False], [False, True]),
25
+ ([True, False], [True, False, False]),
26
+ ([False], [True, False]),
27
+ ],
28
+ )
29
+ def test_concat_preserves_masks_and_forward_kinematics(left, right):
30
+ first, second = make_chain("a", left), make_chain("b", right)
31
+ first_mask, second_mask = (
32
+ first.active_links_mask.copy(),
33
+ second.active_links_mask.copy(),
34
+ )
35
+ combined = Chain.concat(first, second)
36
+ expected = np.array(left + right, dtype=bool)
37
+ np.testing.assert_array_equal(combined.active_links_mask, expected)
38
+ assert combined.active_links_mask.dtype == np.dtype(bool)
39
+ np.testing.assert_array_equal(
40
+ combined.active_from_full(np.arange(len(expected))), np.flatnonzero(expected)
41
+ )
42
+ angles = np.linspace(0.1, 0.5, len(expected))
43
+ np.testing.assert_allclose(
44
+ combined.forward_kinematics(angles),
45
+ first.forward_kinematics(angles[: len(left)])
46
+ @ second.forward_kinematics(angles[len(left) :]),
47
+ )
48
+ combined.active_links_mask[0] = not combined.active_links_mask[0]
49
+ np.testing.assert_array_equal(first.active_links_mask, first_mask)
50
+ np.testing.assert_array_equal(second.active_links_mask, second_mask)
@@ -0,0 +1,22 @@
1
+ import numpy as np
2
+ import pytest
3
+ from ikpy.utils.geometry import to_transformation_matrix
4
+
5
+
6
+ @pytest.mark.parametrize(
7
+ "translation", [[0, 0, 0], [1, -2, 3], np.array([0.25, 4.0, -8.0])]
8
+ )
9
+ def test_translation_only_preserves_points_and_axes(translation):
10
+ frame = to_transformation_matrix(translation)
11
+ points = np.array([[0.0, 0.0, 0.0], [1.0, 2.0, 3.0], [-3.0, 1.0, 2.0]])
12
+ mapped = (frame @ np.column_stack((points, np.ones(3))).T).T
13
+ np.testing.assert_allclose(mapped[:, :3], points + translation)
14
+ np.testing.assert_allclose(mapped[:, 3], 1)
15
+ assert np.linalg.det(frame) == pytest.approx(1)
16
+
17
+
18
+ def test_explicit_orientation_is_preserved():
19
+ rotation = np.array([[0.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]])
20
+ frame = to_transformation_matrix([1, 2, 3], rotation)
21
+ np.testing.assert_array_equal(frame[:3, :3], rotation)
22
+ np.testing.assert_array_equal(frame[:3, 3], [1, 2, 3])
@@ -1 +0,0 @@
1
- __version__ = '4.4.2'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes