helsing-ai/sguaba

A Rust crate that provides hard-to-misuse rigid body transforms (aka "spatial math") for engineers with other things to worry about than linear algebra.

What it solves

Sguaba provides a type-safe way to handle rigid body transforms and spatial math, preventing common engineering errors where coordinates from different coordinate systems are accidentally mixed or misused. It simplifies the process of converting between various global and local coordinate systems used in aerospace and robotics.

How it works

The library uses Rust's type system to make coordinate systems explicit. It provides Coordinate and Vector types that are generic over a CoordinateSystem. A system! macro allows developers to define custom coordinate systems (e.g., PlaneFrd) to ensure that a coordinate in one system cannot be used in another without an explicit transformation.

It supports several standard coordinate systems out of the box:

  • WGS84: Latitude, longitude, and altitude.
  • ECEF: Earth-centered, Earth-fixed Cartesian coordinates.
  • NED: North, East, Down (local tangent plane).
  • FRD: Front, Right, Down (body-relative frame).
  • ENU: East, North, Up.

Users can choose between an "engineering-focused" API (using Pose and Orientation types) or a "math-focused" API (using rigid body transforms and rotations).

Who it’s for

Engineers working with spatial data, robotics, or aerospace systems who need to perform reliable coordinate transformations without manually managing linear algebra.

Highlights

  • Type-safe coordinate systems: Prevents misuse of coordinates across different frames of reference.
  • Comprehensive system support: Built-in support for WGS84, ECEF, NED, FRD, and ENU.
  • Flexible APIs: Offers both intuitive engineering types (Pose/Orientation) and rigorous mathematical transforms.
  • Macro-based system definition: Easily define new coordinate systems with specific semantics.

Related

  • Project
  • Project
  • Project
  • Project