Skip to content

Commit 43c6463

Browse files
[feat] Equality constraints from the model, cassie examples (#35)
* feat: introduce types of barrier constraints * feat: init Model class * fix: fix typo * Revert "feat: introduce types of barrier constraints" This reverts commit 954b9d8. * feat: renewed constraints; base, object, equality (weld, connect) constraints * fix: make second object name required * fix: proper jax class type * feat: joint constraint * fix: extra inverse in difference frame * feat: frame constraint * feat: position constraint * feat: joint constraint * fix: change joint_difference to array difference, to underline requirement on scalar joints in joint task and barrier * feat: add active flag to the constraint * feat: support for constraints in locak IK solver * fix: add NotImplementedError in global IK for constraints * fix: minor fixes based on examples * example: manipulator constrained local ik * hotfix: remove debug pring * example: go2 and g1 examples with constrained contact * fix: frame constraint fix * wip: rework equality constraints, does not work * fix: generalize joint barrier and task to handle multiple nonscalar joints * hotfix: joint task and barrier user mask * example: cassie example, closed kin does not work * example: working cassie example * fix: joint barrier and task fix * fix: everything works * example: cassie squat batched * chore: remove all constraints except for equality constraint * wip: dead-beat ALIP example init * feat: ALIP planar motion demo * feat: rotational motion in ALIP, legs only * feat: torso orientation in ALIP example * refactor: clean up ALIP example * hotfix: Simeon, ne bei * feat: proper alip implementation * minor prints in examples * wip: sobaki layut, karavan idet * feat: finalize example, add visualizations * docs: add caravan to the documentation * chore: remove redundant example * chore: attempt to rework README gifs * chore: attempt to rework README gifs * chore: attempt to rework README gifs * Update README.md * fix: fix joint task for new format, like joint barrier * test: update joint task and barrier tests * test: update configuration tests * chore: add mujoco copyright to copied functions * chore: udpate disclamer for collision file * test: finalize unit tests * docs: add documentation for constraints * ci: attempt to fix problems with mypy * refactor: ruff format * hotfix: pipeline * chore: attempt to fix tests * chore: update cast of one variable * chore: accidentally broke the test --------- Co-authored-by: Simeon <[email protected]>
1 parent f749f00 commit 43c6463

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2069
-232
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/mypy.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@ name: mypy
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
1010
mypy:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Check out the repository
14-
uses: actions/checkout@v3
13+
- name: Check out the repository
14+
uses: actions/checkout@v3
1515

16-
- name: Set up Python
17-
uses: actions/setup-python@v4
18-
with:
19-
python-version: '3.12'
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.12"
2020

21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install -e .
25-
pip install mypy
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e .
25+
pip install mypy
2626
27-
- name: Run mypy
28-
continue-on-error: true
29-
run: |
30-
mypy mjinx
27+
- name: Run mypy
28+
run: |
29+
mypy mjinx

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ubuntu-latest
4040
strategy:
4141
matrix:
42-
python-version: ["3.10", "3.11", "3.12"]
42+
python-version: ["3.10", "3.11", "3.12", "3.13"]
4343

4444
steps:
4545
- name: Check out the repository

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
**Mjinx** is a library for auto-differentiable numerical inverse kinematics, powered by **JAX** and **Mujoco MJX**. The library was heavily inspired by the similar Pinocchio-based tool [pink](https://github.com/stephane-caron/pink/tree/main) and Mujoco-based analogue [mink](https://github.com/kevinzakka/mink/tree/main).
1212

1313
<p align="center">
14-
<img src="img/local_ik_output.gif" style="width: 200px" />
15-
<img src="img/go2_stance.gif" style="width: 200px" />
16-
<img src="img/g1_heart.gif" style="width: 200px"/>
14+
<img src="img/local_ik_output.gif" style="width: 400px" />
15+
<img src="img/go2_stance.gif" style="width: 400px" />
16+
<img src="img/g1_heart.gif" style="width: 400px"/>
17+
<img src="img/cassie_caravan.gif" style="width: 400px"/>
1718
</p>
1819

1920
## Key features

docs/components.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,16 @@ MJINX provides several barrier implementations:
5454
:maxdepth: 1
5555

5656
barriers
57+
58+
***********
59+
Constraints
60+
***********
61+
62+
Constraints represent a new type of component with a strictly enforced equality condition :math:`f(q) = 0`. Those constraints might be either treated strictly as differentiated exponentially stable equality: :math:`\nabla h(q)^T v = -\alpha h(q)`, with :math:`\alpha` controls constraint enforcement and :math:`v` is the velocity vector, or as a soft constraint -- task with high gain.
63+
64+
Yet, only the following constraints are implemented:
65+
66+
.. toctree::
67+
:maxdepth: 1
68+
69+
constraints

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
autodoc_type_aliases = {
2727
"ndarray": ":data:`mjinx.typing.ndarray`",
28+
"ArrayLike": ":data:`mjinx.typing.ArrayLike`",
2829
"ArrayOrFloat": ":data:`mjinx.typing.ArrayOrFloat`",
2930
"ClassKFunctions": ":data:`mjinx.typing.ClassKFunctions`",
3031
"CollisionBody": ":data:`mjinx.typing.CollisionBody`",

docs/constraints.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
:github_url: https://github.com/based-robotics/mjinx/tree/docs/github_pages/docs/constraints.rst
2+
3+
.. _Constraints:
4+
5+
Constraints represent a new type of component with a strictly enforced equality, either hardly or softly.
6+
7+
The constratin is formulated as :math:`f(q) = 0`. Those constraints might be either treated strictly as differentiated exponentially stable equality: :math:`\nabla h(q)^T v = -\alpha h(q)`, with :math:`\alpha` controls constraint enforcement and :math:`v` is the velocity vector, or as a soft constraint -- task with high gain.
8+
9+
Base Constraint
10+
---------------
11+
The foundational class that all constraints extend. It defines the core interface and mathematical properties for constraint objectives.
12+
13+
.. automodule:: mjinx.components.constraints._base
14+
:members:
15+
:member-order: bysource
16+
17+
Model Equality Constraint
18+
-------------------------
19+
The constraints, described in MuJoCo model as equality constrainst.
20+
21+
.. automodule:: mjinx.components.constraints._equality_constraint
22+
:members:
23+
:member-order: bysource
24+
25+
.. Base Task
26+
.. ---------
27+
.. The foundational class that all tasks extend. It defines the core interface and mathematical properties for task objectives.
28+
29+
.. .. automodule:: mjinx.components.tasks._base
30+
.. :members:
31+
.. :member-order: bysource

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ and `MuJoCo MJX <https://mujoco.readthedocs.io/en/stable/mjx.html>`_. The librar
3333
<img src="https://github.com/based-robotics/mjinx/raw/main/img/local_ik_output.gif" style="width: 200px;" alt="KUKA arm example">
3434
<img src="https://github.com/based-robotics/mjinx/raw/main/img/go2_stance.gif" style="width: 200px;" alt="GO2 robot example">
3535
<img src="https://github.com/based-robotics/mjinx/raw/main/img/g1_heart.gif" style="width: 200px;" alt="Heart path example">
36+
<img src="https://github.com/based-robotics/mjinx/raw/main/img/cassie_caravan.gif" style="width: 200px;" alt="Heart path example">
3637
</div>
3738

3839
*************

0 commit comments

Comments
 (0)