Skip to main content

cyberwave-geometry (Python)

Python binding for the Cyberwave geometry core. It holds no formulas of its own — every function here marshals to the C++ library and back. Adding arithmetic to this package would recreate exactly the duplication the core exists to remove.

Install

pip install cyberwave-geometry

The wheel carries libcyberwave_geometry_c beside the package, so a normal install needs no compiler and no separate build. Wheels are published for CPython 3.10-3.14 on manylinux x86_64/aarch64, macOS arm64/x86_64 and Windows AMD64; there is no sdist, because this package compiles the core from the repository root and cannot build from bindings/python alone.

At import time the package looks for the library, in order:

  1. $CYBERWAVE_GEOMETRY_LIBRARY — an explicit path;
  2. beside the package, or in cyberwave_geometry/_lib/ — how a built wheel ships;
  3. $CYBERWAVE_GEOMETRY_BUILD_DIR — a developer's CMake build tree;
  4. the platform loader's own search path.

For local development, from a checkout of the repository:

cmake -S . -B build && cmake --build build -j
export CYBERWAVE_GEOMETRY_LIBRARY=$PWD/build/libcyberwave_geometry_c.so
pip install -e ./bindings/python

If it cannot find the library the ImportError prints every path it tried.

Use

from cyberwave_geometry import Quaternion, Transform, Vector3
from cyberwave_geometry import quaternion as quat, transform as tf

q = quat.from_rpy(0.1, 0.2, 0.3)          # fixed-axis XYZ, the URDF convention
tf.compose(parent, child)
quat.rotate(q, Vector3(1, 0, 0))

Forward kinematics takes a parsed description — this package does not read the Universal Robot Schema, URDF or MJCF; your schema reader does, and hands the result over:

from cyberwave_geometry import JointType
from cyberwave_geometry.fk import JointDescription, RobotDescription, RobotTree

tree = RobotTree(RobotDescription(
    links=["base_link", "tool"],
    joints=[JointDescription("j", "base_link", "tool", JointType.REVOLUTE,
                             axis=Vector3(0, 0, 1))],
))

pose = tree.frame_pose("tool", joint_positions={"j": 1.57})
if pose.available:
    print(pose.transform)
else:
    print("waiting on", pose.missing_joints)

Three outcomes, kept distinct on purpose: a pose, available=False with missing_joints when the robot has not reported that state yet, and a raised GeometryError for a structural problem. Collapsing any of them into a default pose is the failure mode this library prevents.

resolve_chain answers the question a pose call cannot: what a frame would need, before any joint state exists.

chain = tree.resolve_chain("tool")
chain.joints           # ("j",) -- the path, root-side first
chain.required_joints  # ("j",) -- sorted, mimic joints replaced by their sources
chain.sensor_name      # set when the frame is a sensor rather than a link

It raises GeometryError when there is no unique path — an unknown frame, a cycle, an unsupported joint type, or a link two joints claim. That last one is refused rather than resolved through whichever joint the description listed first, because which one wins is an artifact of array order.

GPS poses

A position on Earth is Geodetic(latitude_deg, longitude_deg, altitude_m) -- WGS-84, degrees and metres. A six-degree-of-freedom pose is a GeoPose, whose orientation maps the body frame (forward-left-up) into the local ENU frame at its own position:

from cyberwave_geometry import GeoAnchor, Geodetic, GeoPose
from cyberwave_geometry import geodetic as geo

anchor = GeoAnchor(Geodetic(47.3769, 8.5417, 408.0), heading_deg=30.0)

geo.to_local(anchor, Geodetic(47.3801, 8.5500, 421.0))   # -> Vector3, metres
geo.to_local_pose(anchor, pose)                          # -> Transform, ready for FK
geo.from_local_pose(anchor, transform)                   # -> GeoPose

heading_deg is the true-north bearing of environment +Y, so 0 means the environment frame is ENU. Altitude carries no datum -- MSL vs ellipsoidal is recorded beside the data and never converted here.

Compass bearings and NED attitudes are foreign conventions and go through named adapters, for the same reason wxyz does:

geo.quat_from_compass_heading(137.5)   # degrees CLOCKWISE from true north
geo.quat_from_ned_rpy(roll, pitch, yaw)  # radians; NED pitch is nose-UP

Two traps the adapters exist to prevent: feeding NED angles straight into quat.from_rpy is right at 45 degrees and 90 degrees wrong at every cardinal heading, and NED positive pitch is nose-up where ENU/FLU positive pitch is nose-down. The full convention is CONVENTIONS.md section 9.

Strict by default

Degenerate input raises rather than becoming an identity rotation:

quat.normalize(Quaternion(0, 0, 0, 0))    # GeometryError: invalid_quaternion
geo.validate(Geodetic(91.0, 0.0, 0.0))    # GeometryError: invalid_geodetic

Geodetic values are stricter still: Geodetic.from_dict refuses a missing coordinate rather than defaulting it to zero, because (0, 0) is a real place in the Gulf of Guinea -- a silently relocated robot, not an obvious failure.

Where a call site must stay lenient — parsing persisted JSON that predates any validation — use cyberwave_geometry.compat, which keeps the identity fallback but names it:

from cyberwave_geometry import compat

compat.normalize_quaternion_or_identity(whatever_was_stored)
compat.quaternion_from_wire(values, order="xyzw")   # order is not optional

Component order

A bare four-element array is ambiguous between xyzw (protobuf, ROS, Three.js) and wxyz (MuJoCo, legacy backend payloads), and reading one as the other is silent — you get a real, unit, plausible, wrong rotation. So there is no positional constructor:

Quaternion.from_xyzw(protobuf_values)
Quaternion.from_wxyz(mujoco_values)
q.to_xyzw()

The dataclass fields are declared x, y, z, w — the Cyberwave order, matching cw_geom_quat and the C++ core — so a positional Quaternion(a, b, c, d) is xyzw. Construct with keywords (Quaternion(x=…, y=…, z=…, w=…)) or the named converters above rather than relying on that.

Why ctypes and not a compiled extension

There are no formulas on this side at all -- every function marshals to the C++ core and back -- so a compiled extension would buy nothing but build complexity. The C ABI is the seam a compiled accelerator would slot into later without changing anything above _native.py.

Tests

cd bindings/python && python -m pytest

tests/test_golden.py runs the shared golden vectors — the same file the C++ runner reads, which is what makes "C++ and Python agree" a tested claim. tests/test_binding.py covers what only exists on this side: handle lifetimes, the strict/lenient split, and the named-component discipline. tests/test_geodetic.py covers the geodetic marshalling -- three bare doubles across an ABI, where a field swap would place a robot in the wrong hemisphere without raising anything.

Metadata

Release files for cyberwave-geometry 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for cyberwave-geometry 0.2.7
File Actions
cyberwave_geometry-0.2.7-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for cyberwave_geometry-0.2.7-py3-none-win_amd64.whl
cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details for cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
cyberwave_geometry-0.2.7-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for cyberwave_geometry-0.2.7-py3-none-macosx_11_0_arm64.whl
cyberwave_geometry-0.2.7-py3-none-macosx_10_13_x86_64.whl Python 3 none macOS 10.13+ x86-64 Details for cyberwave_geometry-0.2.7-py3-none-macosx_10_13_x86_64.whl

Total release size: 570.2 kB

Release files / cyberwave_geometry-0.2.7-py3-none-win_amd64.whl

Download URL cyberwave_geometry-0.2.7-py3-none-win_amd64.whl
Size 96.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
b8c441dba53feef849f968d64944288564f2394898e09e7a119e74b6c2ddd4a7
BLAKE2b-256 checksum
How to use checksums
8e55654ae22391136144fa5413e5e2af3b3359ae17a609d502897c83149fbd18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 145.2 kB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
88649514946f0cf273cbca271ba147fa13a6ad115b3bda8abab83c643c6f4281
BLAKE2b-256 checksum
How to use checksums
146db70bd2f30dc9bf0fb41819c7bb56155ef40057ebe71e084ca62198997188
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL cyberwave_geometry-0.2.7-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 125.3 kB
Tags Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
44b7a4869390cc6f22ef180cf453aace392df7023ca576298132a432a9c52828
BLAKE2b-256 checksum
How to use checksums
dab08c16680420c07ce51e498531f2dd30eea641dda803c3b26de0cc20ff068f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / cyberwave_geometry-0.2.7-py3-none-macosx_11_0_arm64.whl

Download URL cyberwave_geometry-0.2.7-py3-none-macosx_11_0_arm64.whl
Size 98.4 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2690c656124fe6f18d9fd52940c7ebf77ed5c454eb70c84786d0c42d45f78783
BLAKE2b-256 checksum
How to use checksums
3c2b6d9e685fa60e614a1404347ae606afab67e8acab22eea2d0736a84db194b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / cyberwave_geometry-0.2.7-py3-none-macosx_10_13_x86_64.whl

Download URL cyberwave_geometry-0.2.7-py3-none-macosx_10_13_x86_64.whl
Size 104.7 kB
Tags Python 3 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
c193cf3c322db94ede01d1acbeddab0f29a100ac0461f86cc195e8ec009c3021
BLAKE2b-256 checksum
How to use checksums
13f28e655da2f45496ebaf77a733352d84152ed9702443587f9390d9d00184c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for cyberwave-geometry 0.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for cyberwave_geometry-0.2.7-py3-none-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page