This pull request implement python binding for sophus that provides access to SO3, SE3, interpolate and iterativeMean features.
Feature list
SO3
Initialize with from_quat(), from_matrix(), exp()
Convert to functions: to_quat(), to_matrix(), log()
Multiplication with SO3 or 3D points
Operator [] for setting/getting items with index or slices
Inverse, copy, print, and len
Function vectorization
SE3
Initialize with from_quat_and_translation(), from_matrix(), from_matrix3x4(), exp()
Convert to functions to_quat_and_translation(), to_matrix(), to_matrix3x4(), log()
Multiplication with SE3 or 3D points
Operator [] for setting/getting items with index or slices
Function vectorization
Inverse, copy, print, and len
Interpolate between two SE3
Iterative mean of a group of SE3
Python module (pysophus) installation step
cd Sophus
pip install .
Vectorization detail
In python, we choose to export our Sophus::SO3 as a vector of SO3 objects by binding the cpp object SO3Group defined below. This is because numerical code in python tends to work with array of values to get efficient program. This approach is inspired by scipy.spatial.transform.Rotation.
class SO3Group : public std::vector<Sophus::SO3<Scalar>>
class SE3Group : public std::vector<Sophus::SE3<Scalar>>
Passing a single SO3/SE3 object to c++ code in python binding
To allow other python binding c++ code to take in a single SO3/SE3 object, we also build a caster so that, even if we wrap SO3Group/SE3Group in python, those can be implicitly converted to the c++ Sophus::SO3/SE3 object at boundaries between languages.
This is so we can pass python SO3/SE3 object to c++ function as if they were regular 1-element Sophus::SO3/SE3 object. This simplifies binding the rest of c++ code. The implicit cast fails if the python object is not a 1-element object.
This pull request implement python binding for sophus that provides access to SO3, SE3, interpolate and iterativeMean features.
Feature list
Python module (pysophus) installation step
Vectorization detail
In python, we choose to export our Sophus::SO3 as a vector of SO3 objects by binding the cpp object
SO3Group
defined below. This is because numerical code in python tends to work with array of values to get efficient program. This approach is inspired by scipy.spatial.transform.Rotation.Passing a single SO3/SE3 object to c++ code in python binding
To allow other python binding c++ code to take in a single SO3/SE3 object, we also build a caster so that, even if we wrap SO3Group/SE3Group in python, those can be implicitly converted to the c++ Sophus::SO3/SE3 object at boundaries between languages. This is so we can pass python SO3/SE3 object to c++ function as if they were regular 1-element Sophus::SO3/SE3 object. This simplifies binding the rest of c++ code. The implicit cast fails if the python object is not a 1-element object.