Skip to content

johanubbink/casadi_transformations

Repository files navigation

CasADi Transformations

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.

Installation

Requirements

  • Python 3.8 or newer
  • CasADi (pip install casadi)
  • (Optional) SciPy — used for testing and comparison

Virtual environment

It is recommended to work inside a virtual environment:

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

Option 1: Install directly from GitHub

If you only want to use the library without editing it:

pip install git+https://github.com/johanubbink/casadi_transformations.git

Option 2: Clone the repository and install locally

If you would like to develop or modify the code:

git clone https://github.com/johanubbink/casadi_transformations.git
cd casadi_transformations
pip install -e .

Available Functions

A full list of available functions can be found in function_descriptions.md.
This file is automatically generated by running: python generate_descriptions.py

Examples

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)

Contributing

If you’d like to add new functions, fix bugs, or improve documentation, feel free to reach out. Contributions are welcome!

Roadmap / Todo

  • Add tests comparing CasADi functions with SciPy equivalents
  • Expand README with background, examples, and usage instructions
  • Add a pyproject.toml for packaging and dependency management

About

A collections of casadi functions for spatial transformations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages