mink 0.0.5__py3-none-any.whl → 0.0.6__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/__init__.py +4 -0
- mink/configuration.py +5 -3
- mink/contrib/__init__.py +8 -0
- mink/contrib/keyboard_teleop/KEYBOARD.md +82 -0
- mink/contrib/keyboard_teleop/__init__.py +9 -0
- mink/contrib/keyboard_teleop/keycodes.py +109 -0
- mink/contrib/keyboard_teleop/teleop_mocap.py +230 -0
- mink/limits/collision_avoidance_limit.py +23 -2
- mink/limits/limit.py +0 -2
- mink/limits/velocity_limit.py +13 -11
- mink/tasks/__init__.py +4 -0
- mink/tasks/equality_constraint_task.py +215 -0
- mink/tasks/exceptions.py +4 -0
- mink/utils.py +54 -16
- {mink-0.0.5.dist-info → mink-0.0.6.dist-info}/METADATA +5 -4
- {mink-0.0.5.dist-info → mink-0.0.6.dist-info}/RECORD +18 -11
- {mink-0.0.5.dist-info → mink-0.0.6.dist-info}/WHEEL +1 -1
- mink-0.0.6.dist-info/licenses/LICENSE +201 -0
mink/__init__.py
CHANGED
@@ -28,6 +28,7 @@ from .solve_ik import build_ik, solve_ik
|
|
28
28
|
from .tasks import (
|
29
29
|
ComTask,
|
30
30
|
DampingTask,
|
31
|
+
EqualityConstraintTask,
|
31
32
|
FrameTask,
|
32
33
|
Objective,
|
33
34
|
PostureTask,
|
@@ -39,6 +40,7 @@ from .utils import (
|
|
39
40
|
custom_configuration_vector,
|
40
41
|
get_body_geom_ids,
|
41
42
|
get_freejoint_dims,
|
43
|
+
get_subtree_body_ids,
|
42
44
|
get_subtree_geom_ids,
|
43
45
|
move_mocap_to_frame,
|
44
46
|
)
|
@@ -53,6 +55,7 @@ __all__ = (
|
|
53
55
|
"RelativeFrameTask",
|
54
56
|
"PostureTask",
|
55
57
|
"Task",
|
58
|
+
"EqualityConstraintTask",
|
56
59
|
"Objective",
|
57
60
|
"ConfigurationLimit",
|
58
61
|
"VelocityLimit",
|
@@ -81,4 +84,5 @@ __all__ = (
|
|
81
84
|
"move_mocap_to_frame",
|
82
85
|
"get_subtree_geom_ids",
|
83
86
|
"get_body_geom_ids",
|
87
|
+
"get_subtree_body_ids",
|
84
88
|
)
|
mink/configuration.py
CHANGED
@@ -43,8 +43,8 @@ class Configuration:
|
|
43
43
|
|
44
44
|
Args:
|
45
45
|
model: Mujoco model.
|
46
|
-
q: Configuration to initialize from. If None, the configuration
|
47
|
-
|
46
|
+
q: Configuration to initialize from. If None, the configuration is
|
47
|
+
initialized to the default configuration `qpos0`.
|
48
48
|
"""
|
49
49
|
self.model = model
|
50
50
|
self.data = mujoco.MjData(model)
|
@@ -62,6 +62,8 @@ class Configuration:
|
|
62
62
|
# mj_kinematics. An extra call to mj_comPos is required for updated Jacobians.
|
63
63
|
mujoco.mj_kinematics(self.model, self.data)
|
64
64
|
mujoco.mj_comPos(self.model, self.data)
|
65
|
+
if self.model.neq > 0:
|
66
|
+
mujoco.mj_makeConstraint(self.model, self.data)
|
65
67
|
|
66
68
|
def update_from_keyframe(self, key_name: str) -> None:
|
67
69
|
"""Update the configuration from a keyframe.
|
@@ -104,7 +106,7 @@ class Configuration:
|
|
104
106
|
model=self.model,
|
105
107
|
)
|
106
108
|
else:
|
107
|
-
logging.
|
109
|
+
logging.debug(
|
108
110
|
f"Value {qval:.2f} at index {jnt} is outside of its limits: "
|
109
111
|
f"[{qmin:.2f}, {qmax:.2f}]"
|
110
112
|
)
|
mink/contrib/__init__.py
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Keyboard Controls for Teleoperation
|
2
|
+
This document explains the keyboard input handling system implemented in the `TeleopMocap` class for teleoperation.
|
3
|
+
The system allows users to toggle different movement modes, adjust speeds, and control the movement of a mocap body in a simulation.
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
## Overview
|
8
|
+
The `TeleopMocap` class provides keyboard-based control for moving and rotating the mocap body in a Mujoco simulation.
|
9
|
+
Features:
|
10
|
+
- 6 degrees of freedom (DOF) movement
|
11
|
+
- Toggling between manual and non-manual movement
|
12
|
+
- Switching between rotation and translation
|
13
|
+
- Adjusting movement and rotation step sizes
|
14
|
+
- Alternating between different mocap data
|
15
|
+
|
16
|
+
---
|
17
|
+
|
18
|
+
## Key Mappings
|
19
|
+
| Key | Action |
|
20
|
+
|-----|--------|
|
21
|
+
| `9` | Toggle teleoperation On/Off. |
|
22
|
+
| `n` | Toggle between manual and non-manual mode. |
|
23
|
+
| `.` | Toggle between rotation and translation mode. |
|
24
|
+
| `8` | Cycle through different mocap data. |
|
25
|
+
| `+` | Increase movement step size or movement speed. |
|
26
|
+
| `-` | Decrease movement step size or movement speed. |
|
27
|
+
| **Arrow Keys** | **Move (rotation / translation) along the X, Y, and Z axes** |
|
28
|
+
| `Up` | Move forward (+X) or rotates around X-axis in positive direction. |
|
29
|
+
| `Down` | Move backward (-X) or rotates around X-axis in negative direction. |
|
30
|
+
| `Right` | Move right (+Y) or rotates around Y-axis in positive direction. |
|
31
|
+
| `Left` | Move left (-Y) or rotates around Y-axis in negative direction. |
|
32
|
+
| `7` | Move up (+Z) or rotates around Z-axis in positive direction. |
|
33
|
+
| `6` | Move down (-Z) or rotates around Z-axis in negative direction. |
|
34
|
+
|
35
|
+
---
|
36
|
+
|
37
|
+
## Modes
|
38
|
+
### **Manual vs. Non-Manual Mode:**
|
39
|
+
- **Manual Mode**: Iterative movement using arrow keys.
|
40
|
+
- **Non-Manual Mode**: Continuous movement using arrow keys (to stop continuous movement, re-click the arrow key).
|
41
|
+
|
42
|
+
### **Rotation vs. Translation Mode:**
|
43
|
+
- **Rotation Mode**: Rotation around an axis.
|
44
|
+
- **Translation Mode**: Movement along an axis.
|
45
|
+
|
46
|
+
---
|
47
|
+
|
48
|
+
## Example Usage
|
49
|
+
To use the `TeleopMocap` class, instantiate it and pass the `mjData`.
|
50
|
+
Pass the `key_callback_data` method as a `key_callback` in the mujoco viewer.
|
51
|
+
Call the `auto_key_move()` in the viewer loop.
|
52
|
+
|
53
|
+
```python
|
54
|
+
import mink
|
55
|
+
...
|
56
|
+
data = MjData(model)
|
57
|
+
...
|
58
|
+
# Initialize the key callback handler
|
59
|
+
key_callback = mink.TeleopMocap(data)
|
60
|
+
|
61
|
+
# Pass the key callback function into the viewer
|
62
|
+
with mujoco.viewer.launch_passive(
|
63
|
+
model=model, data=data,
|
64
|
+
show_left_ui=False, show_right_ui=False,
|
65
|
+
key_callback=key_callback.key_callback_data
|
66
|
+
) as viewer:
|
67
|
+
while viewer.is_running():
|
68
|
+
...
|
69
|
+
key_callback.auto_key_move()
|
70
|
+
...
|
71
|
+
```
|
72
|
+
|
73
|
+
---
|
74
|
+
|
75
|
+
## Limitations
|
76
|
+
`Mink` uses the `mujoco.viewer.launch_passive()` for visualization and maintaining the simulation loop.
|
77
|
+
To pass keyboard callbacks, we have to pass a callback function `key_callback(key)` as an argument to the `launch_passive()`.
|
78
|
+
However, this has several limitations:
|
79
|
+
- Only being able to register one key press at a time.
|
80
|
+
- It can only register one key action (which is the action PRESS); can't register key holds (act.HOLD) or releases (act.RELEASE).
|
81
|
+
- Doesn't support key + modifier combinations in (e.g., Ctrl + Arrow keys).
|
82
|
+
- Viewer has a lot of default keybinds, which limits the amount of free keys to use for movement.
|
@@ -0,0 +1,109 @@
|
|
1
|
+
"""
|
2
|
+
This file contains key codes for keyboard input handling.
|
3
|
+
"""
|
4
|
+
|
5
|
+
KEY_UNKNOWN = -1
|
6
|
+
KEY_SPACE = 32
|
7
|
+
KEY_APOSTROPHE = 39
|
8
|
+
KEY_COMMA = 44
|
9
|
+
KEY_MINUS = 45
|
10
|
+
KEY_PERIOD = 46
|
11
|
+
KEY_SLASH = 47
|
12
|
+
KEY_0 = 48
|
13
|
+
KEY_1 = 49
|
14
|
+
KEY_2 = 50
|
15
|
+
KEY_3 = 51
|
16
|
+
KEY_4 = 52
|
17
|
+
KEY_5 = 53
|
18
|
+
KEY_6 = 54
|
19
|
+
KEY_7 = 55
|
20
|
+
KEY_8 = 56
|
21
|
+
KEY_9 = 57
|
22
|
+
KEY_SEMICOLON = 59
|
23
|
+
KEY_EQUAL = 61
|
24
|
+
KEY_A = 65
|
25
|
+
KEY_B = 66
|
26
|
+
KEY_C = 67
|
27
|
+
KEY_D = 68
|
28
|
+
KEY_E = 69
|
29
|
+
KEY_F = 70
|
30
|
+
KEY_G = 71
|
31
|
+
KEY_H = 72
|
32
|
+
KEY_I = 73
|
33
|
+
KEY_J = 74
|
34
|
+
KEY_K = 75
|
35
|
+
KEY_L = 76
|
36
|
+
KEY_M = 77
|
37
|
+
KEY_N = 78
|
38
|
+
KEY_O = 79
|
39
|
+
KEY_P = 80
|
40
|
+
KEY_Q = 81
|
41
|
+
KEY_R = 82
|
42
|
+
KEY_S = 83
|
43
|
+
KEY_T = 84
|
44
|
+
KEY_U = 85
|
45
|
+
KEY_V = 86
|
46
|
+
KEY_W = 87
|
47
|
+
KEY_X = 88
|
48
|
+
KEY_Y = 89
|
49
|
+
KEY_Z = 90
|
50
|
+
KEY_LEFT_BRACKET = 91
|
51
|
+
KEY_BACKSLASH = 92
|
52
|
+
KEY_RIGHT_BRACKET = 93
|
53
|
+
KEY_GRAVE_ACCENT = 96
|
54
|
+
KEY_ESCAPE = 256
|
55
|
+
KEY_ENTER = 257
|
56
|
+
KEY_TAB = 258
|
57
|
+
KEY_BACKSPACE = 259
|
58
|
+
KEY_INSERT = 260
|
59
|
+
KEY_DELETE = 261
|
60
|
+
KEY_RIGHT = 262
|
61
|
+
KEY_LEFT = 263
|
62
|
+
KEY_DOWN = 264
|
63
|
+
KEY_UP = 265
|
64
|
+
KEY_PAGE_UP = 266
|
65
|
+
KEY_PAGE_DOWN = 267
|
66
|
+
KEY_HOME = 268
|
67
|
+
KEY_END = 269
|
68
|
+
KEY_CAPS_LOCK = 280
|
69
|
+
KEY_SCROLL_LOCK = 281
|
70
|
+
KEY_NUM_LOCK = 282
|
71
|
+
KEY_PRINT_SCREEN = 283
|
72
|
+
KEY_PAUSE = 284
|
73
|
+
KEY_F1 = 290
|
74
|
+
KEY_F2 = 291
|
75
|
+
KEY_F3 = 292
|
76
|
+
KEY_F4 = 293
|
77
|
+
KEY_F5 = 294
|
78
|
+
KEY_F6 = 295
|
79
|
+
KEY_F7 = 296
|
80
|
+
KEY_F8 = 297
|
81
|
+
KEY_F9 = 298
|
82
|
+
KEY_F10 = 299
|
83
|
+
KEY_F11 = 300
|
84
|
+
KEY_F12 = 301
|
85
|
+
KEY_KP_0 = 320
|
86
|
+
KEY_KP_1 = 321
|
87
|
+
KEY_KP_2 = 322
|
88
|
+
KEY_KP_3 = 323
|
89
|
+
KEY_KP_4 = 324
|
90
|
+
KEY_KP_5 = 325
|
91
|
+
KEY_KP_6 = 326
|
92
|
+
KEY_KP_7 = 327
|
93
|
+
KEY_KP_8 = 328
|
94
|
+
KEY_KP_9 = 329
|
95
|
+
KEY_KP_DECIMAL = 330
|
96
|
+
KEY_KP_DIVIDE = 331
|
97
|
+
KEY_KP_MULTIPLY = 332
|
98
|
+
KEY_KP_SUBTRACT = 333
|
99
|
+
KEY_KP_ADD = 334
|
100
|
+
KEY_KP_ENTER = 335
|
101
|
+
KEY_KP_EQUAL = 336
|
102
|
+
KEY_LEFT_SHIFT = 340
|
103
|
+
KEY_LEFT_CONTROL = 341
|
104
|
+
KEY_LEFT_ALT = 342
|
105
|
+
KEY_LEFT_SUPER = 343
|
106
|
+
KEY_RIGHT_SHIFT = 344
|
107
|
+
KEY_RIGHT_CONTROL = 345
|
108
|
+
KEY_RIGHT_ALT = 346
|
109
|
+
KEY_RIGHT_SUPER = 347
|
@@ -0,0 +1,230 @@
|
|
1
|
+
from functools import partial
|
2
|
+
|
3
|
+
import mujoco
|
4
|
+
import numpy as np
|
5
|
+
|
6
|
+
from . import keycodes
|
7
|
+
|
8
|
+
|
9
|
+
class TeleopMocap:
|
10
|
+
"""
|
11
|
+
Class to handle keyboard input for teleoperation.
|
12
|
+
The class provides methods to toggle teleoperation on/off,
|
13
|
+
switch between manual and non-manual modes,
|
14
|
+
adjust step sizes / speed for movement and rotation,
|
15
|
+
and select movements based on key presses.
|
16
|
+
"""
|
17
|
+
|
18
|
+
def __init__(self, data):
|
19
|
+
self.on = False
|
20
|
+
self.data = data
|
21
|
+
self.reset_state()
|
22
|
+
self.actions = {
|
23
|
+
keycodes.KEY_N: self.toggle_manual, # n: toggle non-manual mode
|
24
|
+
keycodes.KEY_PERIOD: self.toggle_rotation, # .: toggle rotation mode
|
25
|
+
keycodes.KEY_8: self.toggle_mocap, # 8: toggle mocap data
|
26
|
+
keycodes.KEY_EQUAL: partial(self.toggle_speed, 1), # =/+: increase speed
|
27
|
+
keycodes.KEY_MINUS: partial(self.toggle_speed, -1), # -: decrease speed
|
28
|
+
keycodes.KEY_UP: partial(
|
29
|
+
self.movement_select, keycodes.KEY_UP, 0, 1
|
30
|
+
), # Up arrow
|
31
|
+
keycodes.KEY_DOWN: partial(
|
32
|
+
self.movement_select, keycodes.KEY_DOWN, 0, -1
|
33
|
+
), # Down arrow
|
34
|
+
keycodes.KEY_RIGHT: partial(
|
35
|
+
self.movement_select, keycodes.KEY_RIGHT, 1, 1
|
36
|
+
), # Right arrow
|
37
|
+
keycodes.KEY_LEFT: partial(
|
38
|
+
self.movement_select, keycodes.KEY_LEFT, 1, -1
|
39
|
+
), # Left arrow
|
40
|
+
keycodes.KEY_7: partial(self.movement_select, keycodes.KEY_7, 2, 1), # 6
|
41
|
+
keycodes.KEY_6: partial(self.movement_select, keycodes.KEY_6, 2, -1), # 7
|
42
|
+
}
|
43
|
+
self.movements = {
|
44
|
+
keycodes.KEY_UP: partial(self.movement_select, -1, 0, 1), # Up arrow
|
45
|
+
keycodes.KEY_DOWN: partial(self.movement_select, -1, 0, -1), # Down arrow
|
46
|
+
keycodes.KEY_RIGHT: partial(self.movement_select, -1, 1, 1), # Right arrow
|
47
|
+
keycodes.KEY_LEFT: partial(self.movement_select, -1, 1, -1), # Left arrow
|
48
|
+
keycodes.KEY_7: partial(self.movement_select, -1, 2, 1), # 6
|
49
|
+
keycodes.KEY_6: partial(self.movement_select, -1, 2, -1), # 7
|
50
|
+
}
|
51
|
+
self.opposite_keys = {
|
52
|
+
keycodes.KEY_UP: keycodes.KEY_DOWN,
|
53
|
+
keycodes.KEY_DOWN: keycodes.KEY_UP,
|
54
|
+
keycodes.KEY_RIGHT: keycodes.KEY_LEFT,
|
55
|
+
keycodes.KEY_LEFT: keycodes.KEY_RIGHT,
|
56
|
+
keycodes.KEY_7: keycodes.KEY_6,
|
57
|
+
keycodes.KEY_6: keycodes.KEY_7,
|
58
|
+
}
|
59
|
+
|
60
|
+
def __call__(self, key):
|
61
|
+
# Toggle teleop on/off
|
62
|
+
if key == keycodes.KEY_9: # 9
|
63
|
+
self.toggle_on()
|
64
|
+
return
|
65
|
+
|
66
|
+
# Do nothing if teleop is off
|
67
|
+
if not self.on:
|
68
|
+
return
|
69
|
+
|
70
|
+
if key in self.actions:
|
71
|
+
self.actions[key]()
|
72
|
+
|
73
|
+
def auto_key_move(self):
|
74
|
+
"""
|
75
|
+
Automatically move the mocap body based on key presses.
|
76
|
+
"""
|
77
|
+
|
78
|
+
if not self.on:
|
79
|
+
return
|
80
|
+
|
81
|
+
for key, action in self.movements.items():
|
82
|
+
if self.keys[key]:
|
83
|
+
action()
|
84
|
+
|
85
|
+
def movement_select(self, key, axis, direction):
|
86
|
+
"""
|
87
|
+
Select the movement direction based on the key pressed.
|
88
|
+
"""
|
89
|
+
|
90
|
+
if not self.manual and key != -1:
|
91
|
+
self.keys[key] = not self.keys[key]
|
92
|
+
self.keys[self.opposite_keys[key]] = False
|
93
|
+
elif not self.manual and key == -1:
|
94
|
+
self.rot_or_trans(key, axis, direction)
|
95
|
+
elif self.manual:
|
96
|
+
self.rot_or_trans(key, axis, direction)
|
97
|
+
|
98
|
+
def rot_or_trans(self, key, axis, direction):
|
99
|
+
"""
|
100
|
+
Adjust the position or rotation of the mocap body based on rotation mode.
|
101
|
+
"""
|
102
|
+
|
103
|
+
if self.rotation:
|
104
|
+
self.adjust_rotation(key, axis, direction)
|
105
|
+
else:
|
106
|
+
self.adjust_position(key, axis, direction)
|
107
|
+
|
108
|
+
def adjust_position(self, key, axis, direction):
|
109
|
+
"""
|
110
|
+
Adjust the position of the mocap body in the specified direction
|
111
|
+
based on the axis and step size.
|
112
|
+
"""
|
113
|
+
|
114
|
+
q = self.data.mocap_quat[self.mocap_idx].copy()
|
115
|
+
rot = np.zeros(shape=(9,), dtype=np.float64)
|
116
|
+
mujoco.mju_quat2Mat(rot, q)
|
117
|
+
rot = rot.reshape((3, 3))
|
118
|
+
unit_vec = rot[:, axis]
|
119
|
+
step_size = self.m_step_size if self.manual else self.nm_step_size
|
120
|
+
self.data.mocap_pos[self.mocap_idx] += direction * step_size * unit_vec
|
121
|
+
|
122
|
+
def adjust_rotation(self, key, axis, direction):
|
123
|
+
"""
|
124
|
+
Adjust the rotation of the mocap body in the specified direction
|
125
|
+
based on the axis and step size.
|
126
|
+
"""
|
127
|
+
|
128
|
+
step_size = self.m_rotation_step if self.manual else self.nm_rotation_step
|
129
|
+
self.data.mocap_quat[self.mocap_idx] = self.rotate_quaternion(
|
130
|
+
self.data.mocap_quat[self.mocap_idx], axis, direction * step_size
|
131
|
+
)
|
132
|
+
|
133
|
+
def rotate_quaternion(self, quat, axis, angle):
|
134
|
+
"""
|
135
|
+
Rotate a quaternion by an angle around an axis.
|
136
|
+
"""
|
137
|
+
rot = np.zeros(shape=(4,), dtype=np.float64)
|
138
|
+
result = np.zeros(shape=(4,), dtype=np.float64)
|
139
|
+
|
140
|
+
unit_axis = np.zeros(shape=(3,), dtype=np.float64)
|
141
|
+
if axis == 0:
|
142
|
+
unit_axis[0] = 1.0
|
143
|
+
elif axis == 1:
|
144
|
+
unit_axis[1] = 1.0
|
145
|
+
elif axis == 2:
|
146
|
+
unit_axis[2] = 1.0
|
147
|
+
|
148
|
+
angle_rad = np.deg2rad(angle)
|
149
|
+
unit_axis = unit_axis / np.linalg.norm(unit_axis)
|
150
|
+
mujoco.mju_axisAngle2Quat(rot, unit_axis, angle_rad)
|
151
|
+
mujoco.mju_mulQuat(result, rot, quat)
|
152
|
+
return result
|
153
|
+
|
154
|
+
def toggle_on(self):
|
155
|
+
self.on = not self.on
|
156
|
+
state = "On" if self.on else "Off"
|
157
|
+
print(f"Keyboard Teleoperation toggled: {state}!")
|
158
|
+
self.reset_state()
|
159
|
+
print()
|
160
|
+
|
161
|
+
def toggle_manual(self):
|
162
|
+
self.manual = not self.manual
|
163
|
+
manual_state = "On" if self.manual else "Off"
|
164
|
+
print(f"Manual mode toggled: {manual_state}!")
|
165
|
+
self.reset_keys()
|
166
|
+
print()
|
167
|
+
|
168
|
+
def toggle_rotation(self):
|
169
|
+
self.rotation = not self.rotation
|
170
|
+
state = "On" if self.rotation else "Off"
|
171
|
+
print(f"Rotation mode toggled: {state}!")
|
172
|
+
self.reset_keys()
|
173
|
+
print()
|
174
|
+
|
175
|
+
def toggle_speed(self, direction):
|
176
|
+
factor = 1.10 if direction == 1 else 0.9
|
177
|
+
if self.manual:
|
178
|
+
if self.rotation:
|
179
|
+
self.m_rotation_step *= factor
|
180
|
+
else:
|
181
|
+
self.m_step_size *= factor
|
182
|
+
else:
|
183
|
+
if self.rotation:
|
184
|
+
self.nm_rotation_step *= factor
|
185
|
+
else:
|
186
|
+
self.nm_step_size *= factor
|
187
|
+
|
188
|
+
output = "Manual" if self.manual else "Non-manual"
|
189
|
+
mode = "Rotation" if self.rotation else "Translation"
|
190
|
+
if self.manual:
|
191
|
+
step_size = self.m_rotation_step if self.rotation else self.m_step_size
|
192
|
+
else:
|
193
|
+
step_size = self.nm_rotation_step if self.rotation else self.nm_step_size
|
194
|
+
print(f"{output} {mode} step size: {step_size:.8f}")
|
195
|
+
|
196
|
+
def toggle_mocap(self):
|
197
|
+
self.mocap_idx = (self.mocap_idx + 1) % self.data.mocap_pos.shape[
|
198
|
+
0
|
199
|
+
] # cycle through mocap data
|
200
|
+
print(f"Current mocap index: {self.mocap_idx}")
|
201
|
+
|
202
|
+
def reset_keys(self):
|
203
|
+
self.keys = {
|
204
|
+
keycodes.KEY_UP: False,
|
205
|
+
keycodes.KEY_DOWN: False,
|
206
|
+
keycodes.KEY_RIGHT: False,
|
207
|
+
keycodes.KEY_LEFT: False,
|
208
|
+
keycodes.KEY_7: False,
|
209
|
+
keycodes.KEY_6: False,
|
210
|
+
}
|
211
|
+
|
212
|
+
def reset_step_size(self):
|
213
|
+
self.m_step_size = 0.01 # manual step size
|
214
|
+
self.m_rotation_step = 10 # manual rotation step
|
215
|
+
self.nm_step_size = 1e-4 # non-manual step size
|
216
|
+
self.nm_rotation_step = 5e-2 # non-manual rotation step
|
217
|
+
print("Step sizes have been reset!")
|
218
|
+
|
219
|
+
def reset_state(self):
|
220
|
+
self.reset_keys()
|
221
|
+
self.reset_step_size()
|
222
|
+
self.manual = True
|
223
|
+
self.rotation = False
|
224
|
+
self.mocap_idx = 0
|
225
|
+
str = f"States have been reset: \n \
|
226
|
+
- Manual mode: {self.manual} \
|
227
|
+
- Rotation mode: {self.rotation} \n \
|
228
|
+
- Mocap index: {self.mocap_idx}"
|
229
|
+
|
230
|
+
print(str)
|
@@ -19,6 +19,23 @@ CollisionPairs = Sequence[CollisionPair]
|
|
19
19
|
|
20
20
|
@dataclass(frozen=True)
|
21
21
|
class Contact:
|
22
|
+
"""Struct to store contact information between two geoms.
|
23
|
+
|
24
|
+
Attributes:
|
25
|
+
dist: Smallest signed distance between geom1 and geom2. If no collision of
|
26
|
+
distance smaller than distmax is found, this value is equal to distmax [1].
|
27
|
+
fromto: Segment connecting the closest points on geom1 and geom2. The first
|
28
|
+
three elements are the coordinates of the closest point on geom1, and the
|
29
|
+
last three elements are the coordinates of the closest point on geom2.
|
30
|
+
geom1: ID of geom1.
|
31
|
+
geom2: ID of geom2.
|
32
|
+
distmax: Maximum distance between geom1 and geom2.
|
33
|
+
|
34
|
+
References:
|
35
|
+
[1] MuJoCo API documentation. `mj_geomDistance` function.
|
36
|
+
https://mujoco.readthedocs.io/en/latest/APIreference/APIfunctions.html
|
37
|
+
"""
|
38
|
+
|
22
39
|
dist: float
|
23
40
|
fromto: np.ndarray
|
24
41
|
geom1: int
|
@@ -27,12 +44,16 @@ class Contact:
|
|
27
44
|
|
28
45
|
@property
|
29
46
|
def normal(self) -> np.ndarray:
|
47
|
+
"""Contact normal pointing from geom1 to geom2."""
|
30
48
|
normal = self.fromto[3:] - self.fromto[:3]
|
31
|
-
|
49
|
+
mujoco.mju_normalize3(normal)
|
50
|
+
return normal
|
32
51
|
|
33
52
|
@property
|
34
53
|
def inactive(self) -> bool:
|
35
|
-
|
54
|
+
"""Returns True if no distance smaller than distmax is detected between geom1
|
55
|
+
and geom2."""
|
56
|
+
return self.dist == self.distmax
|
36
57
|
|
37
58
|
|
38
59
|
def compute_contact_normal_jacobian(
|
mink/limits/limit.py
CHANGED
mink/limits/velocity_limit.py
CHANGED
@@ -18,11 +18,12 @@ class VelocityLimit(Limit):
|
|
18
18
|
Floating base joints are ignored.
|
19
19
|
|
20
20
|
Attributes:
|
21
|
-
indices: Tangent indices corresponding to velocity-limited joints.
|
21
|
+
indices: Tangent indices corresponding to velocity-limited joints. Shape (nb,).
|
22
22
|
limit: Maximum allowed velocity magnitude for velocity-limited joints, in
|
23
|
-
[m]/[s] for slide joints and [rad]/[s] for hinge joints.
|
23
|
+
[m]/[s] for slide joints and [rad]/[s] for hinge joints. Shape (nb,).
|
24
24
|
projection_matrix: Projection from tangent space to subspace with
|
25
|
-
velocity-limited joints.
|
25
|
+
velocity-limited joints. Shape (nb, nv) where nb is the dimension of the
|
26
|
+
velocity-limited subspace and nv is the dimension of the tangent space.
|
26
27
|
"""
|
27
28
|
|
28
29
|
indices: np.ndarray
|
@@ -46,17 +47,17 @@ class VelocityLimit(Limit):
|
|
46
47
|
for joint_name, max_vel in velocities.items():
|
47
48
|
jid = model.joint(joint_name).id
|
48
49
|
jnt_type = model.jnt_type[jid]
|
49
|
-
jnt_dim = dof_width(jnt_type)
|
50
|
-
jnt_id = model.jnt_dofadr[jid]
|
51
50
|
if jnt_type == mujoco.mjtJoint.mjJNT_FREE:
|
52
51
|
raise LimitDefinitionError(f"Free joint {joint_name} is not supported")
|
52
|
+
vadr = model.jnt_dofadr[jid]
|
53
|
+
vdim = dof_width(jnt_type)
|
53
54
|
max_vel = np.atleast_1d(max_vel)
|
54
|
-
if max_vel.shape != (
|
55
|
+
if max_vel.shape != (vdim,):
|
55
56
|
raise LimitDefinitionError(
|
56
|
-
f"Joint {joint_name} must have a limit of shape ({
|
57
|
+
f"Joint {joint_name} must have a limit of shape ({vdim},). "
|
57
58
|
f"Got: {max_vel.shape}"
|
58
59
|
)
|
59
|
-
index_list.extend(range(
|
60
|
+
index_list.extend(range(vadr, vadr + vdim))
|
60
61
|
limit_list.extend(max_vel.tolist())
|
61
62
|
|
62
63
|
self.indices = np.array(index_list)
|
@@ -64,8 +65,8 @@ class VelocityLimit(Limit):
|
|
64
65
|
self.limit = np.array(limit_list)
|
65
66
|
self.limit.setflags(write=False)
|
66
67
|
|
67
|
-
|
68
|
-
self.projection_matrix = np.eye(model.nv)[self.indices] if
|
68
|
+
nb = len(self.indices)
|
69
|
+
self.projection_matrix = np.eye(model.nv)[self.indices] if nb > 0 else None
|
69
70
|
|
70
71
|
def compute_qp_inequalities(
|
71
72
|
self, configuration: Configuration, dt: float
|
@@ -89,7 +90,8 @@ class VelocityLimit(Limit):
|
|
89
90
|
|
90
91
|
Returns:
|
91
92
|
Pair :math:`(G, h)` representing the inequality constraint as
|
92
|
-
:math:`G \Delta q \leq h`, or ``None`` if there is no limit.
|
93
|
+
:math:`G \Delta q \leq h`, or ``None`` if there is no limit. G has
|
94
|
+
shape (2nb, nv) and h has shape (2nb,).
|
93
95
|
"""
|
94
96
|
del configuration # Unused.
|
95
97
|
if self.projection_matrix is None:
|
mink/tasks/__init__.py
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
from .com_task import ComTask
|
4
4
|
from .damping_task import DampingTask
|
5
|
+
from .equality_constraint_task import EqualityConstraintTask
|
5
6
|
from .exceptions import (
|
7
|
+
InvalidConstraint,
|
6
8
|
InvalidDamping,
|
7
9
|
InvalidGain,
|
8
10
|
InvalidTarget,
|
@@ -25,6 +27,8 @@ __all__ = (
|
|
25
27
|
"TargetNotSet",
|
26
28
|
"InvalidTarget",
|
27
29
|
"TaskDefinitionError",
|
30
|
+
"InvalidConstraint",
|
28
31
|
"InvalidGain",
|
29
32
|
"InvalidDamping",
|
33
|
+
"EqualityConstraintTask",
|
30
34
|
)
|
@@ -0,0 +1,215 @@
|
|
1
|
+
"""Equality constraint task implementation."""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import logging
|
6
|
+
from typing import Optional, Sequence
|
7
|
+
|
8
|
+
import mujoco
|
9
|
+
import numpy as np
|
10
|
+
import numpy.typing as npt
|
11
|
+
|
12
|
+
from ..configuration import Configuration
|
13
|
+
from .exceptions import InvalidConstraint, TaskDefinitionError
|
14
|
+
from .task import Task
|
15
|
+
|
16
|
+
|
17
|
+
def _get_constraint_dim(constraint: int) -> int:
|
18
|
+
"""Return the dimension of an equality constraint in the efc* arrays."""
|
19
|
+
return {
|
20
|
+
mujoco.mjtEq.mjEQ_CONNECT.value: 3,
|
21
|
+
mujoco.mjtEq.mjEQ_WELD.value: 6,
|
22
|
+
mujoco.mjtEq.mjEQ_JOINT.value: 1,
|
23
|
+
mujoco.mjtEq.mjEQ_TENDON.value: 1,
|
24
|
+
}[constraint]
|
25
|
+
|
26
|
+
|
27
|
+
def _get_dense_constraint_jacobian(
|
28
|
+
model: mujoco.MjModel, data: mujoco.MjData
|
29
|
+
) -> np.ndarray:
|
30
|
+
"""Return the dense constraint Jacobian for a model."""
|
31
|
+
if mujoco.mj_isSparse(model):
|
32
|
+
efc_J = np.empty((data.nefc, model.nv))
|
33
|
+
mujoco.mju_sparse2dense(
|
34
|
+
efc_J,
|
35
|
+
data.efc_J,
|
36
|
+
data.efc_J_rownnz,
|
37
|
+
data.efc_J_rowadr,
|
38
|
+
data.efc_J_colind,
|
39
|
+
)
|
40
|
+
return efc_J
|
41
|
+
return data.efc_J.reshape((data.nefc, model.nv)).copy()
|
42
|
+
|
43
|
+
|
44
|
+
class EqualityConstraintTask(Task):
|
45
|
+
"""Regulate equality constraints in a model.
|
46
|
+
|
47
|
+
Equality constraints are useful, among other things, for modeling "loop joints"
|
48
|
+
such as four-bar linkages. In MuJoCo, there are several types of equality
|
49
|
+
constraints, including:
|
50
|
+
|
51
|
+
* ``mjEQ_CONNECT``: Connect two bodies at a point (ball joint).
|
52
|
+
* ``mjEQ_WELD``: Fix relative pose of two bodies.
|
53
|
+
* ``mjEQ_JOINT``: Couple the values of two scalar joints.
|
54
|
+
* ``mjEQ_TENDON``: Couple the values of two tendons.
|
55
|
+
|
56
|
+
This task can regulate all equality constraints in a model or a specific subset
|
57
|
+
identified by name or ID.
|
58
|
+
|
59
|
+
Attributes:
|
60
|
+
equalities: ID or name of the equality constraints to regulate. If not provided,
|
61
|
+
the task will regulate all equality constraints in the model.
|
62
|
+
cost: Cost vector for the equality constraint task. Either a scalar, in which
|
63
|
+
case the same cost is applied to all constraints, or a vector of shape
|
64
|
+
``(neq,)``, where ``neq`` is the number of equality constraints in the
|
65
|
+
model.
|
66
|
+
|
67
|
+
Raises:
|
68
|
+
InvalidConstraint: If a specified equality constraint name or ID is not found,
|
69
|
+
or if the constraint is not active at the initial configuration.
|
70
|
+
TaskDefinitionError: If no equality constraints are found or if cost parameters
|
71
|
+
have invalid shape or values.
|
72
|
+
|
73
|
+
Example:
|
74
|
+
|
75
|
+
.. code-block:: python
|
76
|
+
|
77
|
+
# Regulate all equality constraints with the same cost.
|
78
|
+
eq_task = EqualityConstraintTask(model, cost=1.0)
|
79
|
+
|
80
|
+
# Regulate specific equality constraints with different costs.
|
81
|
+
eq_task = EqualityConstraintTask(
|
82
|
+
model,
|
83
|
+
cost=[1.0, 0.5],
|
84
|
+
equalities=["connect_right", "connect_left"]
|
85
|
+
)
|
86
|
+
"""
|
87
|
+
|
88
|
+
def __init__(
|
89
|
+
self,
|
90
|
+
model: mujoco.MjModel,
|
91
|
+
cost: npt.ArrayLike,
|
92
|
+
equalities: Optional[Sequence[int | str]] = None,
|
93
|
+
gain: float = 1.0,
|
94
|
+
lm_damping: float = 0.0,
|
95
|
+
):
|
96
|
+
self._eq_ids = self._resolve_equality_ids(model, equalities)
|
97
|
+
self._eq_types = model.eq_type[self._eq_ids].copy()
|
98
|
+
self._neq_total = len(self._eq_ids)
|
99
|
+
self._mask: np.ndarray | None = None
|
100
|
+
|
101
|
+
super().__init__(cost=np.zeros((1,)), gain=gain, lm_damping=lm_damping)
|
102
|
+
self.set_cost(cost)
|
103
|
+
|
104
|
+
def set_cost(self, cost: npt.ArrayLike) -> None:
|
105
|
+
"""Set the cost vector for the equality constraint task.
|
106
|
+
|
107
|
+
Args:
|
108
|
+
cost: Cost vector for the equality constraint task.
|
109
|
+
"""
|
110
|
+
cost = np.atleast_1d(cost)
|
111
|
+
if cost.ndim != 1 or cost.shape[0] not in (1, self._neq_total):
|
112
|
+
raise TaskDefinitionError(
|
113
|
+
f"{self.__class__.__name__} cost must be a vector of shape (1,) "
|
114
|
+
f"or ({self._neq_total},). Got {cost.shape}."
|
115
|
+
)
|
116
|
+
if not np.all(cost >= 0.0):
|
117
|
+
raise TaskDefinitionError(f"{self.__class__.__name__} cost must be >= 0")
|
118
|
+
|
119
|
+
# Per constraint cost.
|
120
|
+
self._cost = (
|
121
|
+
np.full((self._neq_total,), cost[0]) if cost.shape[0] == 1 else cost.copy()
|
122
|
+
)
|
123
|
+
|
124
|
+
# Expanded per constraint dimension.
|
125
|
+
repeats = [_get_constraint_dim(eq_type) for eq_type in self._eq_types]
|
126
|
+
self.cost = np.repeat(self._cost, repeats)
|
127
|
+
|
128
|
+
def compute_error(self, configuration: Configuration) -> np.ndarray:
|
129
|
+
"""Compute the equality constraint task error.
|
130
|
+
|
131
|
+
Args:
|
132
|
+
configuration: Robot configuration :math:`q`.
|
133
|
+
|
134
|
+
Returns:
|
135
|
+
Equality constraint task error vector :math:`e(q)`. The shape of the
|
136
|
+
error vector is ``(neq_active * constraint_dim,)``, where ``neq_active``
|
137
|
+
is the number of active equality constraints, and ``constraint_dim``
|
138
|
+
depends on the type of equality constraint.
|
139
|
+
"""
|
140
|
+
self._update_active_constraints(configuration)
|
141
|
+
return configuration.data.efc_pos[self._mask]
|
142
|
+
|
143
|
+
def compute_jacobian(self, configuration: Configuration) -> np.ndarray:
|
144
|
+
"""Compute the task Jacobian at a given configuration.
|
145
|
+
|
146
|
+
Args:
|
147
|
+
configuration: Robot configuration :math:`q`.
|
148
|
+
|
149
|
+
Returns:
|
150
|
+
Equality constraint task jacobian :math:`J(q)`. The shape of the Jacobian
|
151
|
+
is ``(neq_active * constraint_dim, nv)``, where ``neq_active`` is the
|
152
|
+
number of active equality constraints, ``constraint_dim`` depends on the
|
153
|
+
type of equality constraint, and ``nv`` is the dimension of the tangent
|
154
|
+
space.
|
155
|
+
"""
|
156
|
+
self._update_active_constraints(configuration)
|
157
|
+
efc_J = _get_dense_constraint_jacobian(configuration.model, configuration.data)
|
158
|
+
return efc_J[self._mask]
|
159
|
+
|
160
|
+
# Helper functions.
|
161
|
+
|
162
|
+
def _update_active_constraints(self, configuration: Configuration) -> None:
|
163
|
+
self._mask = (
|
164
|
+
configuration.data.efc_type == mujoco.mjtConstraint.mjCNSTR_EQUALITY
|
165
|
+
) & np.isin(configuration.data.efc_id, self._eq_ids)
|
166
|
+
active_eq_ids = configuration.data.efc_id[self._mask]
|
167
|
+
self.cost = self._cost[active_eq_ids]
|
168
|
+
|
169
|
+
def _resolve_equality_ids(
|
170
|
+
self, model: mujoco.MjModel, equalities: Optional[Sequence[int | str]]
|
171
|
+
) -> np.ndarray:
|
172
|
+
eq_ids: list[int] = []
|
173
|
+
|
174
|
+
if equalities is not None:
|
175
|
+
for eq_id_or_name in equalities:
|
176
|
+
eq_id: int
|
177
|
+
if isinstance(eq_id_or_name, str):
|
178
|
+
eq_id = mujoco.mj_name2id(
|
179
|
+
model, mujoco.mjtObj.mjOBJ_EQUALITY, eq_id_or_name
|
180
|
+
)
|
181
|
+
if eq_id == -1:
|
182
|
+
raise InvalidConstraint(
|
183
|
+
f"Equality constraint '{eq_id_or_name}' not found."
|
184
|
+
)
|
185
|
+
else:
|
186
|
+
eq_id = eq_id_or_name
|
187
|
+
if eq_id < 0 or eq_id >= model.neq:
|
188
|
+
raise InvalidConstraint(
|
189
|
+
f"Equality constraint index {eq_id} out of range."
|
190
|
+
f"Must be in range [0, {model.neq})."
|
191
|
+
)
|
192
|
+
if not model.eq_active0[eq_id]:
|
193
|
+
raise InvalidConstraint(
|
194
|
+
f"Equality constraint {eq_id} is not active at initial "
|
195
|
+
"configuration."
|
196
|
+
)
|
197
|
+
else:
|
198
|
+
eq_ids.append(eq_id)
|
199
|
+
# Check for duplicates.
|
200
|
+
if len(eq_ids) != len(set(eq_ids)):
|
201
|
+
raise TaskDefinitionError(
|
202
|
+
f"Duplicate equality constraint IDs provided: {eq_ids}."
|
203
|
+
)
|
204
|
+
else:
|
205
|
+
eq_ids = list(range(model.neq))
|
206
|
+
logging.info("Regulating %d equality constraints", len(eq_ids))
|
207
|
+
|
208
|
+
# Ensure we have at least 1 constraint.
|
209
|
+
if len(eq_ids) == 0:
|
210
|
+
raise TaskDefinitionError(
|
211
|
+
f"{self.__class__.__name__} no equality constraints found in this "
|
212
|
+
"model."
|
213
|
+
)
|
214
|
+
|
215
|
+
return np.array(eq_ids)
|
mink/tasks/exceptions.py
CHANGED
mink/utils.py
CHANGED
@@ -90,39 +90,55 @@ def custom_configuration_vector(
|
|
90
90
|
value = np.atleast_1d(value)
|
91
91
|
if value.shape != (jnt_dim,):
|
92
92
|
raise ValueError(
|
93
|
-
f"Joint {name} should have a qpos value of {jnt_dim,} but "
|
93
|
+
f"Joint {name} should have a qpos value of {(jnt_dim,)} but "
|
94
94
|
f"got {value.shape}"
|
95
95
|
)
|
96
96
|
q[qid : qid + jnt_dim] = value
|
97
97
|
return q
|
98
98
|
|
99
99
|
|
100
|
-
def
|
101
|
-
"""Get
|
100
|
+
def get_body_body_ids(model: mujoco.MjModel, body_id: int) -> list[int]:
|
101
|
+
"""Get immediate children bodies belonging to a given body.
|
102
102
|
|
103
103
|
Args:
|
104
104
|
model: Mujoco model.
|
105
|
-
body_id: ID of body
|
105
|
+
body_id: ID of body.
|
106
106
|
|
107
107
|
Returns:
|
108
|
-
A list containing all
|
108
|
+
A list containing all child body ids.
|
109
109
|
"""
|
110
|
+
return [
|
111
|
+
i
|
112
|
+
for i in range(model.nbody)
|
113
|
+
if model.body_parentid[i] == body_id
|
114
|
+
and body_id != i # Exclude the body itself.
|
115
|
+
]
|
110
116
|
|
111
|
-
def gather_geoms(body_id: int) -> list[int]:
|
112
|
-
geoms: list[int] = []
|
113
|
-
geom_start = model.body_geomadr[body_id]
|
114
|
-
geom_end = geom_start + model.body_geomnum[body_id]
|
115
|
-
geoms.extend(range(geom_start, geom_end))
|
116
|
-
children = [i for i in range(model.nbody) if model.body_parentid[i] == body_id]
|
117
|
-
for child_id in children:
|
118
|
-
geoms.extend(gather_geoms(child_id))
|
119
|
-
return geoms
|
120
117
|
|
121
|
-
|
118
|
+
def get_subtree_body_ids(model: mujoco.MjModel, body_id: int) -> list[int]:
|
119
|
+
"""Get all bodies belonging to subtree starting at a given body.
|
120
|
+
|
121
|
+
Args:
|
122
|
+
model: Mujoco model.
|
123
|
+
body_id: ID of body where subtree starts.
|
124
|
+
|
125
|
+
Returns:
|
126
|
+
A list containing all subtree body ids.
|
127
|
+
"""
|
128
|
+
body_ids: list[int] = []
|
129
|
+
stack = [body_id]
|
130
|
+
while stack:
|
131
|
+
body_id = stack.pop()
|
132
|
+
body_ids.append(body_id)
|
133
|
+
stack += get_body_body_ids(model, body_id)
|
134
|
+
return body_ids
|
122
135
|
|
123
136
|
|
124
137
|
def get_body_geom_ids(model: mujoco.MjModel, body_id: int) -> list[int]:
|
125
|
-
"""Get
|
138
|
+
"""Get immediate geoms belonging to a given body.
|
139
|
+
|
140
|
+
Here, immediate geoms are those directly attached to the body and not its
|
141
|
+
descendants.
|
126
142
|
|
127
143
|
Args:
|
128
144
|
model: Mujoco model.
|
@@ -134,3 +150,25 @@ def get_body_geom_ids(model: mujoco.MjModel, body_id: int) -> list[int]:
|
|
134
150
|
geom_start = model.body_geomadr[body_id]
|
135
151
|
geom_end = geom_start + model.body_geomnum[body_id]
|
136
152
|
return list(range(geom_start, geom_end))
|
153
|
+
|
154
|
+
|
155
|
+
def get_subtree_geom_ids(model: mujoco.MjModel, body_id: int) -> list[int]:
|
156
|
+
"""Get all geoms belonging to subtree starting at a given body.
|
157
|
+
|
158
|
+
Here, a subtree is defined as the kinematic tree starting at the body and including
|
159
|
+
all its descendants.
|
160
|
+
|
161
|
+
Args:
|
162
|
+
model: Mujoco model.
|
163
|
+
body_id: ID of body where subtree starts.
|
164
|
+
|
165
|
+
Returns:
|
166
|
+
A list containing all subtree geom ids.
|
167
|
+
"""
|
168
|
+
geom_ids: list[int] = []
|
169
|
+
stack = [body_id]
|
170
|
+
while stack:
|
171
|
+
body_id = stack.pop()
|
172
|
+
geom_ids.extend(get_body_geom_ids(model, body_id))
|
173
|
+
stack += get_body_body_ids(model, body_id)
|
174
|
+
return geom_ids
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: mink
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.6
|
4
4
|
Summary: mink: MuJoCo inverse kinematics.
|
5
5
|
Keywords: inverse,kinematics,mujoco
|
6
6
|
Author-email: Kevin Zakka <zakka@berkeley.edu>
|
@@ -16,18 +16,19 @@ Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
18
18
|
Classifier: Topic :: Scientific/Engineering
|
19
|
+
License-File: LICENSE
|
19
20
|
Requires-Dist: mujoco >= 3.1.6
|
20
21
|
Requires-Dist: qpsolvers[quadprog] >= 4.3.1
|
21
22
|
Requires-Dist: typing_extensions
|
22
23
|
Requires-Dist: numpy < 2.0.0
|
23
|
-
Requires-Dist: mink[examples,dev] ; extra == "all"
|
24
|
+
Requires-Dist: mink[examples, dev] ; extra == "all"
|
24
25
|
Requires-Dist: black ; extra == "dev"
|
25
26
|
Requires-Dist: mink[test] ; extra == "dev"
|
26
27
|
Requires-Dist: mypy ; extra == "dev"
|
27
28
|
Requires-Dist: ruff ; extra == "dev"
|
28
29
|
Requires-Dist: dm_control >= 1.0.20 ; extra == "examples"
|
29
30
|
Requires-Dist: loop-rate-limiters >= 0.1.0 ; extra == "examples"
|
30
|
-
Requires-Dist: qpsolvers[quadprog,osqp] >= 4.3.1 ; extra == "examples"
|
31
|
+
Requires-Dist: qpsolvers[quadprog, osqp] >= 4.3.1 ; extra == "examples"
|
31
32
|
Requires-Dist: absl-py ; extra == "test"
|
32
33
|
Requires-Dist: coveralls ; extra == "test"
|
33
34
|
Requires-Dist: pytest ; extra == "test"
|
@@ -1,10 +1,10 @@
|
|
1
|
-
mink/__init__.py,sha256=
|
2
|
-
mink/configuration.py,sha256=
|
1
|
+
mink/__init__.py,sha256=g-eOZoPMgO3l4PtP7RK4ercpo1lyLnIcOT6Tb78T968,1829
|
2
|
+
mink/configuration.py,sha256=wbP2ab-Zn5pH844Czk5w8mgDXP44AosMOdNxqwyCSik,9199
|
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
|
6
6
|
mink/solve_ik.py,sha256=hrAnwO5imCoFczmoXQf4v5Rfw5l1wisd0qtmFt-y0vs,3578
|
7
|
-
mink/utils.py,sha256
|
7
|
+
mink/utils.py,sha256=8vQEDdN4zh25nRZLeZWvz2asuu1ksaMCuUY8GuauUxs,5316
|
8
8
|
mink/.mypy_cache/.gitignore,sha256=amnaZw0RUw038PDP3HvtMLeOpkNOJPenMgi5guKdMiw,34
|
9
9
|
mink/.mypy_cache/CACHEDIR.TAG,sha256=8cE6_FVTWMkDOw8fMKqhd_6IvaQPS4okWYQA1UeHatw,190
|
10
10
|
mink/.mypy_cache/3.12/@plugins_snapshot.json,sha256=RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o,2
|
@@ -326,25 +326,32 @@ mink/.mypy_cache/3.12/unittest/signals.data.json,sha256=1ZiaD7LP0g0iBSmVb5g87M9q
|
|
326
326
|
mink/.mypy_cache/3.12/unittest/signals.meta.json,sha256=t4kGxxcZb9aDLojvZ5naLIcckL77G1RAB0P2iJsSjM0,1681
|
327
327
|
mink/.mypy_cache/3.12/unittest/suite.data.json,sha256=3XPU9U8rt00fnG-hgEIbpIqS14lI9xQMDiBsl2_mlXQ,12050
|
328
328
|
mink/.mypy_cache/3.12/unittest/suite.meta.json,sha256=5ADDHudtGO-JtLaD0-SB-7_Ekm34XeG_QCXLEDIZeIM,1699
|
329
|
+
mink/contrib/__init__.py,sha256=njdlTslt_Ot_fB1Uj6MzRwLhmf-MbRNjwgi8krfCD-k,152
|
330
|
+
mink/contrib/keyboard_teleop/KEYBOARD.md,sha256=cYzG3nyOik_ktzha6FZqDiUT7Dn38df8JsXzcGAMmCw,3236
|
331
|
+
mink/contrib/keyboard_teleop/__init__.py,sha256=wtG_0D-RurdQiGTPjLYVXXt44ieh6ITTXqpicg6AXxI,185
|
332
|
+
mink/contrib/keyboard_teleop/keycodes.py,sha256=1AN3bWpkw99ZjrkIQnu8QdHSz-_boWMYWI2LlZOp5uw,1644
|
333
|
+
mink/contrib/keyboard_teleop/teleop_mocap.py,sha256=nq2oywXXyrXoh39_2S-sMdni-4vDrlUdC5D3HfbKUGY,8102
|
329
334
|
mink/lie/__init__.py,sha256=7tm3ZFnF3o1SDd9MOFO1In13lHMQJHO0FB-ejI6tsgE,202
|
330
335
|
mink/lie/base.py,sha256=ummp2-yROMrcYCtsNCoKEiKoJ7wLF0nSjnOOD95aXaY,4220
|
331
336
|
mink/lie/se3.py,sha256=R4hH4i0-do5I8bWV0le-huSuAfQ_bwolkAjJNVlDNXs,7914
|
332
337
|
mink/lie/so3.py,sha256=LkjciJHcVTWYzpDzAo1KuUI7xy0HPnSGAYxQS_q-Kx4,7302
|
333
338
|
mink/lie/utils.py,sha256=DuEl3pj84daLvMKN84-YBvkXnJfqvc5vpvJ9J-pJ11U,403
|
334
339
|
mink/limits/__init__.py,sha256=hX5Dgpri9AE6YtUCkW79AXMBuNAuBhniR9kQ6Rxwv3Y,416
|
335
|
-
mink/limits/collision_avoidance_limit.py,sha256=
|
340
|
+
mink/limits/collision_avoidance_limit.py,sha256=MaaESEclHP_jcv1iAi3iqnQ8fg89A2PAt56nztyNFgE,11911
|
336
341
|
mink/limits/configuration_limit.py,sha256=areR-8NuuD15wWzPhyQIRtttIdfXPlT3hP81MuDbIN0,4351
|
337
342
|
mink/limits/exceptions.py,sha256=EnVKgFhUJFM6rNVCtdngb-XMu66PWKMFSDy-XkdKzr8,178
|
338
|
-
mink/limits/limit.py,sha256=
|
339
|
-
mink/limits/velocity_limit.py,sha256=
|
340
|
-
mink/tasks/__init__.py,sha256=
|
343
|
+
mink/limits/limit.py,sha256=65K4clGFCPxa3TScGaLhYe1rVYgmJnkMnsFg6DCGjI4,1529
|
344
|
+
mink/limits/velocity_limit.py,sha256=KNfwNayy4o6vrAnirnb92HaHVv6OC2De-QgKgZAxyc8,3702
|
345
|
+
mink/tasks/__init__.py,sha256=rTx9Ab8XPSohhSa1RUD7lNggTzVi02LOaPzPZFMFvuI,763
|
341
346
|
mink/tasks/com_task.py,sha256=ch6w7pwa5E0GVo2DCAuEF-c8TCN1iMk-ySY9A4B6yoQ,3121
|
342
347
|
mink/tasks/damping_task.py,sha256=SwSfUvMHzoNYNsloQRD1qlPLd4kfoDIWZlTDU9LuKM4,556
|
343
|
-
mink/tasks/
|
348
|
+
mink/tasks/equality_constraint_task.py,sha256=FvA2LFQFbro1WOh_TqhJehGCOklxKFILJhapXtV8wio,8189
|
349
|
+
mink/tasks/exceptions.py,sha256=d2P9q_CWaHUXxgSwFjcu-ml87mLuXJYxrVLUwrJp6w8,803
|
344
350
|
mink/tasks/frame_task.py,sha256=DeNg-bEJxqnrRI0FaJK4UHyb8CyF4A7uPF9G-CdN0sg,5307
|
345
351
|
mink/tasks/posture_task.py,sha256=sVDZyalCh5DP8zmCuX5kYuZxiMxRut_mTZUjv5y3b5M,3998
|
346
352
|
mink/tasks/relative_frame_task.py,sha256=9rIiYocI1eEESt0bLZZpQR7K6ggVRZH8iEhdhzkfZa0,5119
|
347
353
|
mink/tasks/task.py,sha256=F16YZT1L9ueNOcKoOhbCyEnZw0DOgrmjqADl0jahVQI,4838
|
348
|
-
mink-0.0.
|
349
|
-
mink-0.0.
|
350
|
-
mink-0.0.
|
354
|
+
mink-0.0.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
355
|
+
mink-0.0.6.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
|
356
|
+
mink-0.0.6.dist-info/METADATA,sha256=e6XCGI_DjbdsPticB6skRbXS6k1ENUVsiCwuFDaQeDY,5525
|
357
|
+
mink-0.0.6.dist-info/RECORD,,
|
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|