mink 0.0.3__py3-none-any.whl → 0.0.5__py3-none-any.whl

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.
mink/configuration.py CHANGED
@@ -7,6 +7,7 @@ offering easy access to frame transforms and frame Jacobians. A frame refers to
7
7
  system that can be attached to various parts of the robot, such as a body, geom, or site.
8
8
  """
9
9
 
10
+ import logging
10
11
  from typing import Optional
11
12
 
12
13
  import mujoco
@@ -103,7 +104,7 @@ class Configuration:
103
104
  model=self.model,
104
105
  )
105
106
  else:
106
- print(
107
+ logging.warning(
107
108
  f"Value {qval:.2f} at index {jnt} is outside of its limits: "
108
109
  f"[{qmin:.2f}, {qmax:.2f}]"
109
110
  )
@@ -4,7 +4,7 @@ import mujoco
4
4
  import numpy as np
5
5
 
6
6
  from ..configuration import Configuration
7
- from ..constants import qpos_width
7
+ from ..constants import dof_width, qpos_width
8
8
  from .exceptions import LimitDefinitionError
9
9
  from .limit import Constraint, Limit
10
10
 
@@ -38,19 +38,22 @@ class ConfigurationLimit(Limit):
38
38
  f"{self.__class__.__name__} gain must be in the range (0, 1]"
39
39
  )
40
40
 
41
- index_list: list[int] = []
42
- lower = np.full(model.nq, -np.inf)
43
- upper = np.full(model.nq, np.inf)
41
+ index_list: list[int] = [] # DoF indices that are limited.
42
+ lower = np.full(model.nq, -mujoco.mjMAXVAL)
43
+ upper = np.full(model.nq, mujoco.mjMAXVAL)
44
44
  for jnt in range(model.njnt):
45
45
  jnt_type = model.jnt_type[jnt]
46
46
  qpos_dim = qpos_width(jnt_type)
47
47
  jnt_range = model.jnt_range[jnt]
48
48
  padr = model.jnt_qposadr[jnt]
49
+ # Skip free joints and joints without limits.
49
50
  if jnt_type == mujoco.mjtJoint.mjJNT_FREE or not model.jnt_limited[jnt]:
50
51
  continue
51
52
  lower[padr : padr + qpos_dim] = jnt_range[0] + min_distance_from_limits
52
53
  upper[padr : padr + qpos_dim] = jnt_range[1] - min_distance_from_limits
53
- index_list.append(jnt)
54
+ jnt_dim = dof_width(jnt_type)
55
+ jnt_id = model.jnt_dofadr[jnt]
56
+ index_list.extend(range(jnt_id, jnt_id + jnt_dim))
54
57
 
55
58
  self.indices = np.array(index_list)
56
59
  self.indices.setflags(write=False)
@@ -89,9 +92,11 @@ class ConfigurationLimit(Limit):
89
92
  :math:`G \Delta q \leq h`, or ``None`` if there is no limit.
90
93
  """
91
94
  del dt # Unused.
95
+ if self.projection_matrix is None:
96
+ return Constraint()
92
97
 
93
98
  # Upper.
94
- delta_q_max = np.zeros(self.model.nv)
99
+ delta_q_max = np.zeros((self.model.nv,))
95
100
  mujoco.mj_differentiatePos(
96
101
  m=self.model,
97
102
  qvel=delta_q_max,
@@ -101,7 +106,7 @@ class ConfigurationLimit(Limit):
101
106
  )
102
107
 
103
108
  # Lower.
104
- delta_q_min = np.zeros(self.model.nv)
109
+ delta_q_min = np.zeros((self.model.nv,))
105
110
  mujoco.mj_differentiatePos(
106
111
  m=self.model,
107
112
  qvel=delta_q_min,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mink
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: mink: MuJoCo inverse kinematics.
5
5
  Keywords: inverse,kinematics,mujoco
6
6
  Author-email: Kevin Zakka <zakka@berkeley.edu>
@@ -33,6 +33,8 @@ Requires-Dist: coveralls ; extra == "test"
33
33
  Requires-Dist: pytest ; extra == "test"
34
34
  Requires-Dist: robot_descriptions >= 1.9.0 ; extra == "test"
35
35
  Project-URL: Changelog, https://github.com/kevinzakka/mink/blob/main/CHANGELOG.md
36
+ Project-URL: Documentation, https://kevinzakka.github.io/mink/
37
+ Project-URL: Homepage, https://kevinzakka.github.io/mink/
36
38
  Project-URL: Source, https://github.com/kevinzakka/mink
37
39
  Project-URL: Tracker, https://github.com/kevinzakka/mink/issues
38
40
  Provides-Extra: all
@@ -58,6 +60,20 @@ Features include:
58
60
 
59
61
  For usage and API reference, see the [documentation](https://kevinzakka.github.io/mink/).
60
62
 
63
+ If you use mink in your research, please cite it as follows:
64
+
65
+ ```bibtex
66
+ @software{Zakka_Mink_Python_inverse_2024,
67
+ author = {Zakka, Kevin},
68
+ license = {Apache-2.0},
69
+ month = jul,
70
+ title = {{Mink: Python inverse kinematics based on MuJoCo}},
71
+ url = {https://github.com/kevinzakka/mink},
72
+ version = {0.0.4},
73
+ year = {2024}
74
+ }
75
+ ```
76
+
61
77
  ## Installation
62
78
 
63
79
  You can install `mink` using `pip`:
@@ -77,7 +93,7 @@ pip install "mink[examples]"
77
93
  mink works with a variety of robots, including:
78
94
 
79
95
  * Arms: [UR5e](https://github.com/kevinzakka/mink/blob/main/examples/arm_ur5e_actuators.py), [iiwa14](https://github.com/kevinzakka/mink/blob/main/examples/arm_iiwa.py), [bimanual iiwa14](https://github.com/kevinzakka/mink/blob/main/examples/dual_iiwa.py)
80
- * Humanoids: [Unitree G1](https://github.com/kevinzakka/mink/blob/main/examples/humanoid_g1.py)
96
+ * Humanoids: [Unitree G1](https://github.com/kevinzakka/mink/blob/main/examples/humanoid_g1.py), [Unitree H1](https://github.com/kevinzakka/mink/blob/main/examples/humanoid_h1.py)
81
97
  * Quadrupeds: [Unitree Go1](https://github.com/kevinzakka/mink/blob/main/examples/quadruped_go1.py), [Boston Dynamics Spot](https://github.com/kevinzakka/mink/blob/main/examples/quadruped_spot.py)
82
98
  * Hands: [Shadow Hand](https://github.com/kevinzakka/mink/blob/main/examples/hand_shadow.py), [Allegro Hand](https://github.com/kevinzakka/mink/blob/main/examples/arm_hand_iiwa_allegro.py)
83
99
  * Mobile manipulators: [Stanford TidyBot](https://github.com/kevinzakka/mink/blob/main/examples/mobile_tidybot.py), [Hello Robot Stretch](https://github.com/kevinzakka/mink/blob/main/examples/mobile_stretch.py)
@@ -1,5 +1,5 @@
1
1
  mink/__init__.py,sha256=1-kNZ2BmlC9wD98boMF9tujEz3z9ipx9bTUpE4d8T4c,1717
2
- mink/configuration.py,sha256=ScwX77IGeqsheIvEqp8VUJv1D9dV0ies66vCnYp2zDE,9085
2
+ mink/configuration.py,sha256=SchU0FwPIOjrjwetBVTDbfxTT1OOxLq71tWbLqvvrL4,9110
3
3
  mink/constants.py,sha256=hcWy4zM4hGI7vvJrTmCjJgs2WtOxKJ1IVtYHucWbOAI,813
4
4
  mink/exceptions.py,sha256=tmExo-ydn_mu9Mny5sP0Ehr7hfo3d79fM8HvvxZBKYM,2931
5
5
  mink/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -333,7 +333,7 @@ mink/lie/so3.py,sha256=LkjciJHcVTWYzpDzAo1KuUI7xy0HPnSGAYxQS_q-Kx4,7302
333
333
  mink/lie/utils.py,sha256=DuEl3pj84daLvMKN84-YBvkXnJfqvc5vpvJ9J-pJ11U,403
334
334
  mink/limits/__init__.py,sha256=hX5Dgpri9AE6YtUCkW79AXMBuNAuBhniR9kQ6Rxwv3Y,416
335
335
  mink/limits/collision_avoidance_limit.py,sha256=pVLpkruWAqrOcAW4yulHc_hIuczMR4EbrXF1x-0Bb80,10973
336
- mink/limits/configuration_limit.py,sha256=8GlOIRWHJUX9QCGrmR6YEYkpXntnQxWjd5oz2r8qUb4,4037
336
+ mink/limits/configuration_limit.py,sha256=areR-8NuuD15wWzPhyQIRtttIdfXPlT3hP81MuDbIN0,4351
337
337
  mink/limits/exceptions.py,sha256=EnVKgFhUJFM6rNVCtdngb-XMu66PWKMFSDy-XkdKzr8,178
338
338
  mink/limits/limit.py,sha256=feF9yjgLHWShnuSrJNOH-PfMWtEMRGQi2mDiRia9tFg,1578
339
339
  mink/limits/velocity_limit.py,sha256=2zPOAb69V9RusKk-U4cJ0lK3-Ek9g4nvr3c8QHbixzw,3506
@@ -345,6 +345,6 @@ mink/tasks/frame_task.py,sha256=DeNg-bEJxqnrRI0FaJK4UHyb8CyF4A7uPF9G-CdN0sg,5307
345
345
  mink/tasks/posture_task.py,sha256=sVDZyalCh5DP8zmCuX5kYuZxiMxRut_mTZUjv5y3b5M,3998
346
346
  mink/tasks/relative_frame_task.py,sha256=9rIiYocI1eEESt0bLZZpQR7K6ggVRZH8iEhdhzkfZa0,5119
347
347
  mink/tasks/task.py,sha256=F16YZT1L9ueNOcKoOhbCyEnZw0DOgrmjqADl0jahVQI,4838
348
- mink-0.0.3.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
349
- mink-0.0.3.dist-info/METADATA,sha256=_cnAalKVJSiTLM-tTJ9qpFwwrPO14bkFd_CPZ3TCkEE,4961
350
- mink-0.0.3.dist-info/RECORD,,
348
+ mink-0.0.5.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
349
+ mink-0.0.5.dist-info/METADATA,sha256=IWndykbTUh_K9MyGE_cAojds8tqJJFOJLBma1nXF-Fo,5501
350
+ mink-0.0.5.dist-info/RECORD,,
File without changes