liecasadi
liecasadi implements Lie groups operation written in CasADi, mainly directed to optimization problem formulation.
Inspired by A micro Lie theory for state estimation in robotics and the library Manif.
🐍 Install
Conda
Create a conda environment
conda create -n liecasadienv
and install the library
conda install liecasadi
Pip
Create a virtual environment, if you prefer. For example:
pip install virtualenv
python3 -m venv your_virtual_env
source your_virtual_env/bin/activate
Inside the virtual environment, install the library from pip:
pip install liecasadi
If you want the last version:
pip install "liecasadi @ git+https://github.com/ami-iit/lie-casadi.git"
Implemented Groups
| Group | Description |
|---|---|
| SO3 | 3D Rotations |
| SE3 | 3D Rigid Transform |
🚀 Operations
Being:
-
$X, Y \in SO3, \ SE3$
-
$w \in \text{SO3Tangent}, \ \text{SE3Tangent}$
-
$v \in \mathbb{R}^3$
| Operation | Code | |
|---|---|---|
| Inverse | $X^{-1}$ | X.inverse() |
| Composition | $X \circ Y$ | X*Y |
| Exponential | $\text{exp}(w)$ | phi.exp() |
| Act on vector | $X \circ v$ | X.act(v) |
| Logarithm | $\text{log}(X)$ | X.log() |
| Manifold right plus | $X \oplus w = X \circ \text{exp}(w)$ | X + phi |
| Manifold left plus | $w \oplus X = \text{exp}(w) \circ X$ | phi + X |
| Manifold minus | $X-Y = \text{log}(Y^{-1} \circ X)$ | X-Y |
🦸♂️ Example
from liecasadi import SE3, SO3, SE3Tangent, SO3Tangent
# Random quaternion + normalization
quat = (np.random.rand(4) - 0.5) * 5
quat = quat / np.linalg.norm(quat)
# Random vector
vector3d = (np.random.rand(3) - 0.5) * 2 * np.pi
# Create SO3 object
rotation = SO3(quat)
# Create Identity
identity = SO3.Identity()
# Create SO3Tangent object
tangent = SO3Tangent(vector3d)
# Random translation vector
pos = (np.random.rand(3) - 0.5) * 5
# Create SE3 object
transform = SE3(pos=pos, xyzw=quat)
# Random vector
vector6d = (np.random.rand(3) - 0.5) * 5
# Create SE3Tangent object
tangent = SO3Tangent(vector6d)
Dual Quaternion example
from liecasadi import SE3, DualQuaternion
from numpy import np
# orientation quaternion generation
quat1 = (np.random.rand(4) - 0.5) * 5
quat1 = quat1 / np.linalg.norm(quat1)
quat2 = (np.random.rand(4) - 0.5) * 5
quat2 = quat2 / np.linalg.norm(quat2)
# translation vector generation
pos1 = (np.random.rand(3) - 0.5) * 5
pos2 = (np.random.rand(3) - 0.5) * 5
dual_quaternion1 = DualQuaternion(quat1, pos1)
dual_quaternion2 = DualQuaternion(quat2, pos2)
# from a homogenous matrix
# (using liecasadi.SE3 to generate the corresponding homogenous matrix)
H = SE3.from_position_quaternion(pos, quat).as_matrix()
dual_quaternion1 = DualQuaternion.from_matrix(H)
# Concatenation of rigid transforms
q1xq2 = dual_quaternion1 * dual_quaternion2
# to homogeneous matrix
print(q1xq2.as_matrix())
# obtain translation
print(q1xq2.translation())
# obtain rotation
print(q1xq2.rotation().as_matrix())
# transform a point
point = np.random.randn(3,1)
transformed_point = dual_quaternion1.transform_point(point)
# create an identity dual quaternion
I = DualQuaternion.Identity()
🦸♂️ Contributing
liecasadi is an open-source project. Contributions are very welcome!
Open an issue with your feature request or if you spot a bug. Then, you can also proceed with a Pull-requests! 🚀
Metadata
Release files for liecasadi 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| liecasadi-0.0.7.tar.gz | 16.4 kB | With provenance | Details for liecasadi-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| liecasadi-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for liecasadi-0.0.7-py3-none-any.whl |
Total release size: 27.7 kB
Release files / liecasadi-0.0.7.tar.gz
| Download URL | liecasadi-0.0.7.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c469d6477301954450207fadf9ffa5cd35968785834ef26c10b20e33bb195763
|
|
BLAKE2b-256 checksum How to use checksums |
5245f76b2b9528b97c749c199d0c1b694cb083eddf943838905a53fa1a09b961
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / liecasadi-0.0.7-py3-none-any.whl
| Download URL | liecasadi-0.0.7-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38d7c6784f0e364925bdace897a7f072c12192f9f73f9532cf453bcd0acb4f13
|
|
BLAKE2b-256 checksum How to use checksums |
379829d815431b967554ac185739ef1da0dc9a8378a66809b65233d07b66d194
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logSecurity for liecasadi 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for liecasadi-0.0.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.