All Projects → arntanguy → PySophus

arntanguy / PySophus

Licence: other
Python bindings for Sophus Lie Algebra C++ Library

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to PySophus

FormTracer
A Mathematica Tracing Package Using FORM
Stars: ✭ 16 (-69.23%)
Mutual labels:  lie-group, lie-groups
pytomlpp
A python wrapper for tomlplusplus
Stars: ✭ 56 (+7.69%)
Mutual labels:  python-wrapper
MemePolice bot
This is a bot for r/PewdiepieSubmissions. Moderate harmful submissions by applying OCR on graphical content
Stars: ✭ 26 (-50%)
Mutual labels:  python-wrapper
syntaxnet wrapper
A Python Wrapper for Google SyntaxNet
Stars: ✭ 34 (-34.62%)
Mutual labels:  python-wrapper
TransformUtils.jl
Lie groups and algebra with some quaternions
Stars: ✭ 18 (-65.38%)
Mutual labels:  lie-groups
cdk pywrapper
A Python wrapper for the Chemistry Development Kit (CDK)
Stars: ✭ 25 (-51.92%)
Mutual labels:  python-wrapper
python-sutime
Python wrapper for Stanford CoreNLP's SUTime
Stars: ✭ 143 (+175%)
Mutual labels:  python-wrapper
psgd tf
Tensorflow implementation of preconditioned stochastic gradient descent
Stars: ✭ 33 (-36.54%)
Mutual labels:  lie-groups
PySiddhi
Python wrapper for Siddhi engine
Stars: ✭ 22 (-57.69%)
Mutual labels:  python-wrapper
mujoco
Python wrapper for MuJoCo physics simulation.
Stars: ✭ 12 (-76.92%)
Mutual labels:  python-wrapper
pyduktape
Embed the Duktape JS interpreter in Python
Stars: ✭ 77 (+48.08%)
Mutual labels:  python-wrapper
gpyfft
python wrapper for the OpenCL FFT library clFFT
Stars: ✭ 52 (+0%)
Mutual labels:  python-wrapper
axxb calibration
A Comprehensive AX = XB Calibration Solvers in Matlab
Stars: ✭ 19 (-63.46%)
Mutual labels:  lie-group
psycopgr
A Python wrapper of pgRouting for routing from nodes to nodes on real map.
Stars: ✭ 24 (-53.85%)
Mutual labels:  python-wrapper
Parallel.GAMIT
Python wrapper to parallelize GAMIT executions
Stars: ✭ 22 (-57.69%)
Mutual labels:  python-wrapper
spdlog-python
python wrapper around C++ spdlog ([email protected]:gabime/spdlog.git)
Stars: ✭ 46 (-11.54%)
Mutual labels:  python-wrapper
wolfssl-py
Python wrapper for wolfSSL embedded SSL/TLS library.
Stars: ✭ 30 (-42.31%)
Mutual labels:  python-wrapper
TopOpt in PETSc wrapped in Python
Topology optimization using PETSc: a Python wrapper and extended functionality
Stars: ✭ 24 (-53.85%)
Mutual labels:  python-wrapper
grblas
Python wrapper around GraphBLAS
Stars: ✭ 22 (-57.69%)
Mutual labels:  python-wrapper
chess.com
Python wrapper for Chess.com Published-Data API
Stars: ✭ 34 (-34.62%)
Mutual labels:  python-wrapper

PySophus

Overview

PySophus defines python bindings for Sophus library.

Sophus is a c++ implementation of Lie oproups commonly used for 2d and 3d geometric problems (i.e. for Computer Vision or Robotics applications). Among others, this package includes the special orthogonal groups SO(2) and SO(3) to present rotations in 2d and 3d as well as the special Euclidean group SE(2) and SE(3) to represent rigid body transformations (i.e. rotations and translations) in 2d and 3d.

Dependencies

This package uses:

  • eigency For basic Eigen support.
  • Sophus for Lie algebra support.

Supported operations

Updated on 23/03/2017

So far, only basic operations are supported:

  • SE3, SO3 representation
  • Most common group operations (exp, log, vee, hat)
  • Operators on groups (group multiplication *)
  • Single axis factories (rotX, rotY, rotZ, trans(x,y,z), transX, transY, transZ)
  • ... (Look at sophus.pxd for a complete list of supported operations)

If you require any functionality that is not currently in the wrapper, feel free to open a merge request.

How to install

First, setup eigency

git clone https://github.com/wouterboomsma/eigency.git
cd eigency
python setup.py build_ext --inplace
# put in your bashrc
export PYTHONPATH="$PYTHONPATH:<path to eigency>"

Then, clone this repository, and run

git clone https://github.com/arntanguy/PySophus.git
cd PySophus
git submodule init
git submodule update
python setup.py build_ext --inplace
# put in your bashrc
export PYTHONPATH="$PYTHONPATH:<path to PySophus>"

Usage

Python usage is transparent, the naming convention of Sophus is kept for the bindings

from sophus import *
import numpy as np

# Default SE3 group element (Identity)
T = SE3()
# Single axis factory: rotation around axis
Tx = SE3.rotX(1.3)
Ty = SE4.rotY(0.5)
# Group operators
T_prod = Tx * Ty

# Group Exponential and Log operations
t = T_prod.log()
T = SE3.exp(t)
R = T.so3()
r = R.log()
R = SO3.exp(r)

# Conversion to/from numpy
numpy_mat = T.matrix()
numpy_mat[0,3] = 2;
T = SE3(numpy_mat)
T.log()

x = np.array([1,0,0,0,0,0]).T
T = SE3.exp(x)
print(T)

Notes

  • Eigency expects F_CONTIGUOUS layout, numpy works by defaults on C_CONTIGUOUS arrays
# Create C_CONTIGUOUS array
T2_C = np.array([[1, 0, 0, 0],
                     [0, math.cos(angle), -math.sin(angle), 0],
                     [0, math.sin(angle), math.cos(angle), 0],
                     [0, 0, 0, 1]])

# Create F_CONTIGUOUS array
T2_F = np.array([[1, 0, 0, 0],
                     [0, math.cos(angle), -math.sin(angle), 0],
                     [0, math.sin(angle), math.cos(angle), 0],
                     [0, 0, 0, 1]], order='F')

# T2_F is F_CONTIGUOUS, memory is simply mapped to eigency
T_F = SE3(T2_F)

# T2_C is first converted from C_CONTIGUOUS to F_CONTIGUOUS, which causes a copy
T_C = SE3(T2_numpy)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].