rai-opensource/spatialmath-python
Create, manipulate and convert representations of position and orientation in 2D or 3D using Python
What it solves
Spatial mathematics is the foundation of robotics and robotic vision, as it allows developers to describe the position, orientation, and pose of objects in 2D or 3D spaces. This library provides a standardized, type-safe way to handle these complex geometric transformations without manually managing raw matrices.
How it works
The library provides high-level classes that abstract NumPy arrays into mathematical groups. It uses specific classes for different dimensions and representations:
- 3D Space:
SE3(pose),SO3(orientation),UnitQuaternion(orientation),Twist3(pose), andUnitDualQuaternion(pose). - 2D Space:
SE2(pose),SO2(orientation), andTwist2(pose).
These classes support overloaded operators for composition (*), point transformation (*), and exponents (**), as well as methods for normalization, inversion, and conversion between Euler angles, roll-pitch-yaw, and angle-axis forms. It also includes low-level functions for those who prefer working directly with NumPy arrays and supports symbolic variables via SymPy.
Who it’s for
It is designed for robotics researchers and engineers who need to perform spatial transformations and pose estimations, as well as students using the "Robotics, Vision & Control" textbook.
Highlights
- Type Safety: Prevents the accidental mixing of 2D and 3D transformation matrices.
- Vectorization: Supports creating and operating on sequences of rotation matrices or poses in a single line.
- Visualization: Includes built-in tools for plotting transforms (
trplot) and creating animations (tranimate). - Symbolic Support: Compatible with SymPy for mathematical derivations using symbolic variables.
Related
- Project
- Project
- Project
- Project
- Project