PyPose: A Library for Robot Learning with Physics-based Optimization

PyPose
PyTorch
Published in
3 min readDec 6, 2023

--

PyPose is now part of the PyTorch Ecosystem!

PyPose

We are excited to share our new open-source library PyPose. It is a PyTorch-based robotics-oriented library that provides a set of tools and algorithms for connecting deep learning with physics-based optimization.

PyPose was developed with the aim of making it easier for researchers and developers to build and deploy robotics applications. With PyPose, you can easily create and test various control, planning, SLAM, or other optimization-based algorithms and connect them with deep learning-based perception algorithms.

Motivation

Deep learning has had remarkable success in robotic perception, but its data-centric nature suffers when it comes to generalizing to ever-changing environments. By contrast, physics-based optimization generalizes better, but it does not perform as well in complicated tasks due to the lack of high-level semantic information and reliance on manual parametric tuning. Taking the best of both worlds, PyPose is created to address deep perceptual models with physics-based optimization.

PyPose for researchers and developers

PyPose’s architecture is clean and well-organized with an imperative style interface following PyTorch, and is efficient and user-friendly, making it easy to integrate into real-world robotic applications. PyPose supports parallel computing of any order gradients of Lie groups and Lie algebra and 2nd-order optimizers. PyPose achieved more than 10x speedup in computation compared to state-of-the-art libraries. PyPose functionalities include but are not limited to SLAM, planning, inertial navigation, and control.

Some of the features of PyPose include:

Examples

Usage example

The following code sample shows how to rotate random points and compute the gradient of batched rotation.

>>> import torch, pypose as pp
>>> # A random so(3) LieTensor
>>> r = pp.randn_so3(2, requires_grad=True)
so3Type LieTensor:
tensor([[ 0.1606, 0.0232, -1.5516],
[-0.0807, -0.7184, -0.1102]], requires_grad=True)
>>> R = r.Exp() # Equivalent to: R = pp.Exp(r)
SO3Type LieTensor:
tensor([[ 0.0724, 0.0104, -0.6995, 0.7109],
[-0.0395, -0.3513, -0.0539, 0.9339]], grad_fn=<AliasBackward0>)
>>> p = R @ torch.randn(3) # Rotate random point
tensor([[ 0.8045, -0.8555, 0.5260],
[ 0.3502, 0.8337, 0.9154]], grad_fn=<ViewBackward0>)
>>> p.sum().backward() # Compute gradient
>>> r.grad # Print gradient
tensor([[-0.7920, -0.9510, 1.7110],
[-0.2659, 0.5709, -0.3855]])

For more usage, see Documentation. For more applications, see Examples.

Conclusion

We believe PyPose revolutionizes robot learning by seamlessly connecting classic robotics with modern learning methods. Development of PyPose is continuous. We are adding more functionalities to our library to address various tasks from several fields of robot learning.

If you are interested in learning and using PyPose, then get started with our tutorials.

We welcome developers from around the world. If you are interested in contributing to PyPose, then get started with our GitHub contribution.

--

--

PyPose
PyTorch
Writer for

An open-source library to connect classic robotics with modern learning methods seamlessly.