Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
05b708e
Add InverseKinematics class
Giulero Jul 7, 2025
2c206e3
Refactor: Introduce Target class and add some documentation
Giulero Jul 8, 2025
4943741
Update type hints
Giulero Jul 8, 2025
b27ab28
Add liecasadi to dependencies in ci_env.yml, ci_env_win.yml, and pypr…
Giulero Jul 8, 2025
2e908d0
Small fix
Giulero Jul 8, 2025
309161f
Add methods for retrieving Opti and KinDynComputations objects. Add m…
Giulero Jul 8, 2025
856e589
Import TargetType
Giulero Jul 8, 2025
eacccf1
Replace mamba with conda in installation instructions for consistency
Giulero Jul 8, 2025
65aa1db
Add Inverse Kinematics interface using CasADi with example usage
Giulero Jul 8, 2025
282bae5
Update src/adam/casadi/inverse_kinematics.py
Giulero Jul 8, 2025
7b09c36
Update src/adam/casadi/inverse_kinematics.py
Giulero Jul 8, 2025
ca8aeed
Modify argument in constraint to highlight the possibility to set it …
Giulero Jul 9, 2025
9b558e7
Refactor rotation error calculation
Giulero Jul 9, 2025
d904681
Update src/adam/casadi/inverse_kinematics.py
Giulero Jul 9, 2025
0e1299e
Update src/adam/casadi/inverse_kinematics.py
Giulero Jul 9, 2025
74d1801
Update example
Giulero Jul 9, 2025
e895012
Use as_soft_constraint also in the targets
Giulero Jul 9, 2025
6c3c5bc
Update readme with as_soft_constraint
Giulero Jul 9, 2025
2d957b1
Update src/adam/casadi/inverse_kinematics.py
Giulero Jul 9, 2025
c1ff75b
Update src/adam/casadi/inverse_kinematics.py
Giulero Jul 9, 2025
636d134
Clarify documentation for as_soft_constraint parameter in InverseKine…
Giulero Jul 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 50 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,29 +111,28 @@ pip install .[selected-interface]

#### Installation from conda-forge package


- Install **CasADi** interface:

```bash
mamba create -n adamenv -c conda-forge adam-robotics-casadi
conda create -n adamenv -c conda-forge adam-robotics-casadi
```

- Install **Jax** interface (warning: not available on Windows):

```bash
mamba create -n adamenv -c conda-forge adam-robotics-jax
conda create -n adamenv -c conda-forge adam-robotics-jax
```

- Install **PyTorch** interface (warning: not available on Windows):

```bash
mamba create -n adamenv -c conda-forge adam-robotics-pytorch
conda create -n adamenv -c conda-forge adam-robotics-pytorch
```

- Install **ALL** interfaces (warning: not available on Windows):

```bash
mamba create -n adamenv -c conda-forge adam-robotics-all
conda create -n adamenv -c conda-forge adam-robotics-all
```

> [!NOTE]
Expand All @@ -146,31 +145,31 @@ Install in a conda environment the required dependencies:
- **Jax** interface dependencies:

```bash
mamba create -n adamenv -c conda-forge jax numpy lxml prettytable matplotlib urdfdom-py
conda create -n adamenv -c conda-forge jax numpy lxml prettytable matplotlib urdfdom-py
```

- **CasADi** interface dependencies:

```bash
mamba create -n adamenv -c conda-forge casadi numpy lxml prettytable matplotlib urdfdom-py
conda create -n adamenv -c conda-forge casadi numpy lxml prettytable matplotlib urdfdom-py
```

- **PyTorch** interface dependencies:

```bash
mamba create -n adamenv -c conda-forge pytorch numpy lxml prettytable matplotlib urdfdom-py jax2torch
conda create -n adamenv -c conda-forge pytorch numpy lxml prettytable matplotlib urdfdom-py jax2torch
```

- **ALL** interfaces dependencies:

```bash
mamba create -n adamenv -c conda-forge jax casadi pytorch numpy lxml prettytable matplotlib urdfdom-py jax2torch
conda create -n adamenv -c conda-forge jax casadi pytorch numpy lxml prettytable matplotlib urdfdom-py jax2torch
```

Activate the environment, clone the repo and install the library:

```bash
mamba activate adamenv
conda activate adamenv
git clone https://github.com/ami-iit/ADAM.git
cd adam
pip install --no-deps .
Expand Down Expand Up @@ -352,6 +351,46 @@ M = kinDyn.mass_matrix(w_H_b_batch, joints_batch)
w_H_f = kinDyn.forward_kinematics('frame_name', w_H_b_batch, joints_batch)
```

### Inverse Kinematics

adam provides an interface for solving inverse kinematics problems using CasADi. The solver supports

- position, orientation, and full pose constraints
- frame-to-frame constraints (ball, fixed)
- optional joint limit constraints

```python
import casadi as cs
import numpy as np
import adam
from adam.casadi import KinDynComputations
from adam.casadi.inverse_kinematics import InverseKinematics, TargetType

# Load your robot model
import icub_models
model_path = icub_models.get_model_file("iCubGazeboV2_5")
# The joint list
joints_name_list = ...
# Create IK solver
ik = InverseKinematics(model_path, joints)
# Add a pose target on a frame (e.g., the left sole)
ik.add_target("l_sole", target_type=TargetType.POSE, as_soft_constraint=True, weight=1.0)
ik.add_ball_constraint(frame_1, frame_2, as_soft_constraint=True)

# Update the target to a desired pose
desired_position = np.array([0.3, 0.2, 1.0])
desired_orientation = np.eye(3)
ik.update_target("l_sole", (desired_position, desired_orientation))

# Solve
ik.solve()

# Retrieve solution
w_H_b_sol, q_sol = ik.get_solution()
print("Base pose:\n", w_H_b_sol)
print("Joint values:\n", q_sol)
```

## 🦸‍♂️ Contributing

**adam** is an open-source project. Contributions are very welcome!
Expand Down
1 change: 1 addition & 0 deletions ci_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dependencies:
- pytorch
- jax2torch
- requests
- liecasadi
1 change: 1 addition & 0 deletions ci_env_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ dependencies:
- icub-models
- idyntree >=11.0.0
- requests
- liecasadi
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ test = [
"black",
"jax2torch",
"requests",
"liecasadi",
]
conversion = ["idyntree"]
all = ["jax", "jaxlib", "casadi>=3.6", "torch", "jax2torch"]
Expand All @@ -57,7 +58,7 @@ all = ["jax", "jaxlib", "casadi>=3.6", "torch", "jax2torch"]
"Source" = "https://github.com/ami-iit/adam"

[tool.setuptools]
package-dir = {"" = "src"} # keeps the src/ layout
package-dir = { "" = "src" } # keeps the src/ layout

[tool.setuptools.packages.find]
where = ["src"]
Expand Down
1 change: 1 addition & 0 deletions src/adam/casadi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

from .casadi_like import CasadiLike
from .computations import KinDynComputations
from .inverse_kinematics import InverseKinematics, TargetType
Loading
Loading