Skip to main content

Geometric algebra tools targeted towards robotics applications

Project description

Geometric Algebra For RObotics in Python

This library provides a geometric algebra tools targeted towards robotics applications. It includes various computations for the kinematics and dynamics of serial manipulators as well as optimal control.

It is based on gafro, a C++ library relying on templates to efficiently implement the geometric algebra operations.

Please visit https://gitlab.com/gafro in order to find the entire gafro software stack.

Installation using pip

pip install pygafro

Installation from source

(works either in a conda or virtual environment)

Note: Tests are run automatically after the compilation, and requires numpy to be installed.

mkdir build && cd build
cmake ..
make
make install

Usage

Multivectors

from pygafro import Multivector
from pygafro import Point
from pygafro import Motor

# create a multivector that corresponds to a Euclidean vector
vector = Multivector.create(['e1', 'e2', 'e3'], [1.0, 2.0, 3.0])

# create a point (a specialized multivector subclass)
point = Point(1.0, 2.0, 3.0)

# create a random motor
motor = Motor.Random()

# apply the motor to our multivectors
vector2 = motor.apply(vector)
point2 = motor.apply(point)

# geometric product
result = vector * point

# inner product
result = vector | point

# outer product
result = vector ^ point

Robots

from pygafro import FrankaEmikaRobot

panda = FrankaEmikaRobot()

position = panda.getRandomConfiguration()

# forward kinematics: compute the motor at the end-effector
ee_motor = panda.getEEMotor(position)

Differences between gafro and pygafro

gafro being based on C++ templates, only the classes and operations you are effectively using are compiled into your software.

This versatility cannot be achieved in a Python library: we cannot instantiate the templates at runtime, nor can we realistically instantiate all the possible combinations at compile time.

A compromise was choosen: a subset of multivectors (using sensible blades combinations) are instantiated and compiled, and other blades combinations are supported through a Python class that internally use a C++ multivector with more blades and transparently use a mask to only expose the blades requested by the user.

Thus, creating a multivector is done using the following helper function:

# using values
vector = Multivector.create(['e1', 'e2', 'e3'], [1.0, 2.0, 3.0])

# using only the list of blades
vector = Multivector.create(['e1', 'e2', 'e3', 'ei', 'e123i'])

Background

You can find the accompanying article here and more information on our website.

How to cite

If you use gafro in your research, please cite the

@article{loewGeometricAlgebraOptimal2023,
  title = {Geometric {{Algebra}} for {{Optimal Control}} with {{Applications}} in {{Manipulation Tasks}}},
  author = {L\"ow, Tobias and Calinon, Sylvain},
  date = {2023},
  journal = {IEEE Transactions on Robotics},
  doi = {10.1109/TRO.2023.3277282}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygafro-1.0.0.tar.gz (49.8 MB view details)

Uploaded Source

File details

Details for the file pygafro-1.0.0.tar.gz.

File metadata

  • Download URL: pygafro-1.0.0.tar.gz
  • Upload date:
  • Size: 49.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.9

File hashes

Hashes for pygafro-1.0.0.tar.gz
Algorithm Hash digest
SHA256 26efe445186db1ddd05f5fa9e9584d5a977a51f3d3ce0a2511b5e477c1d710d5
MD5 4526dd332791e937f533a09b2bcf5502
BLAKE2b-256 ca80d94ac608782b5389a0e0e76e67bff2b677512bd4452844fd116b00589971

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page