A small library providing a collection of transformation functions implemented in CasADi. These functions can be useful when working with symbolic expressions, automatic differentiation, and optimization problems in CasADi.
It is recommended to work inside a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateIf you only want to use the library without editing it:
pip install git+https://github.com/johanubbink/casadi_transformations.gitIf you would like to develop or modify the code:
git clone https://github.com/johanubbink/casadi_transformations.git
cd casadi_transformations
pip install -e .A full list of available functions can be found in function_descriptions.md.
This file is automatically generated by running: python generate_descriptions.py
import casadi as ca
import casadi_transformations as ct
# Example 1: Rotation matrix logarithm
R = ca.SX.eye(3)
w_hat = ct.logm_SO3(R)
print("logm_SO3(R) =", w_hat)
# Example 2: Convert rotation matrix to rotation vector
rotvec = ct.rotvec_from_SO3(R)
print("rotvec_from_SO3(R) =", rotvec)
# Example 3: Construct a homogeneous transform from translation + Euler angles
xyz = ca.SX([1.0, 2.0, 3.0])
rpy = ca.SX([0.1, 0.2, 0.3])
T = ct.SE3_from_xyz_rpy(xyz, rpy)
print("SE3_from_xyz_rpy =", T)
# Example 4: Relative angle
theta1 = ca.SX(3.14)
theta2 = ca.SX(-3.0)
delta = ct.relative_angle(theta1, theta2)
print("Relative angle =", delta)If you’d like to add new functions, fix bugs, or improve documentation, feel free to reach out. Contributions are welcome!
- Add tests comparing CasADi functions with SciPy equivalents
- Expand README with background, examples, and usage instructions
- Add a
pyproject.tomlfor packaging and dependency management