Skip to main content

Automatically compute and apply coordinate frame transformations

Project description

frame-transforms

frame-transforms is a lightweight, thread-safe, Python-native package to simplify frame transforms in robotics. With it, you can manage and translate between coordinate frames with ease. It features:

  1. Automatic computation of transitive transforms.
  2. Registration and update of relative coordinate frames.
  3. An intuitive, object-oriented API.

Though in beta, the library is extensively tested.

This package was inspired by the interface of posetree and shares much of its functionality but offers a more batteries-included experience. Similarly to posetree's nomenclature, Pose is a location and orientation in space, whereas Transform is an action that describes the change in position and orientation to get from one Pose to another.

Installation

pip install frame-transforms

Application

Consider a simple robot consisting of a mobile base and a camera mounted on a gimbal.

The camera detects an object in its coordinate frame. Where is it in world frame?

# Setup
registry.update(Frame.WORLD, Frame.BASE, base_transform)
registry.update(Frame.BASE, Frame.CAMERA, camera_transform)

# Define the Pose
object_pose = Pose(
    Transform(
        np.array([1, 0, 0]),
        Rotation.from_euler("xyz", [0, 0, 0], degrees=True),
    ),
    parent_frame=Frame.CAMERA,
    registry=registry,
)

# Get the position and orientation of the object in world frame
position_in_world = object_pose.get_position(Frame.WORLD)
orientation_in_world = object_pose.get_orientation(Frame.WORLD)

ROS Integration

Simply wrap the Register in a ROS node, subscribing to pose updates and publishing/service-calling the poses. The Register is thread-safe, so callbacks are simple.

Alternatives

  • tf2: Heavyweight, requires ROS.
  • posetree: Requires PoseTree subclass implementation.

Examples

Development Setup

  • Clone and cd into this repository.
  • Set up virtual environment.
    • python -m venv venv
    • source venv/bin/activate (Linux/Mac) or venv\Scripts\activate (Windows)
  • Install package with dev and test dependencies
    • pip install -e '.[dev,test]'

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

frame_transforms-0.3.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frame_transforms-0.3.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file frame_transforms-0.3.0.tar.gz.

File metadata

  • Download URL: frame_transforms-0.3.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for frame_transforms-0.3.0.tar.gz
Algorithm Hash digest
SHA256 70c04fc9699585ad92bed616bae70a88eb532682eda46146dbafa57716319f25
MD5 47acf15a9acb305bb6c6094bd78a3db4
BLAKE2b-256 a0037564394936b940f4cae9f4ff50fd1b171e81f618b44a46043b2bd5dc5d83

See more details on using hashes here.

Provenance

The following attestation bundles were made for frame_transforms-0.3.0.tar.gz:

Publisher: publish-to-pypi.yml on MinhxNguyen7/FrameTransforms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file frame_transforms-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for frame_transforms-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b7fe4cbb9e3caff32844dc598a1511c7e466cc1b201543c1641bc889c677e43
MD5 b6ab3c8de3385f229abd21cd256ca575
BLAKE2b-256 8f22552023598f72ced6c176e043393886ed766464be2041a5aa0a84c15c34b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for frame_transforms-0.3.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on MinhxNguyen7/FrameTransforms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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