Skip to content

bindings/python: add float32 bindings - #2932

Open
Sergim96 wants to merge 1 commit into
stack-of-tasks:develfrom
Sergim96:topic/float32_bindings
Open

bindings/python: add float32 bindings#2932
Sergim96 wants to merge 1 commit into
stack-of-tasks:develfrom
Sergim96:topic/float32_bindings

Conversation

@Sergim96

Copy link
Copy Markdown

Description

This PR adds core single-precision Python bindings exposed through the new
pinocchio.float32 module.

The change:

  • adds a Python binding context using float as its scalar type;
  • exposes numpy.float32 as pinocchio.float32.ScalarType;
  • makes sample-model factories and affected model/frame algorithms use the
    active binding scalar instead of hard-coded double types;
  • adds float32-specific exp, log, and utils helpers;
  • registers native submodules under pinocchio.float32.*;
  • fixes the scalar-generic model, frame, LCABA, and ADMM implementations needed
    by the bindings;
  • integrates the extension into the CMake build and installation, controlled by
    BUILD_PYTHON_BINDINGS_WITH_FLOAT32_SUPPORT;
  • adds the extension to the stub-generation dependencies;
  • adds regression coverage for RNEA, sample models, model and frame algorithms,
    helper dtypes, submodule imports, LCABA, ADMM, and collision-enabled sample
    geometry.

This allows Pinocchio's core kinematics and dynamics APIs to operate directly
on single-precision NumPy arrays.

Geometry and collision objects retain their existing double-backed
representation. File parsers, parallel algorithms, and reachable-workspace
helpers remain available only through the main module.

Checklist

  • I have run pre-commit run --all-files or pixi run lint
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • I have made corresponding changes to the doxygen documentation
  • I have added tests that prove my fix or feature works
  • I have updated the CHANGELOG or added the "no changelog" label if it's a CI-related issue
  • I have updated the README credits section

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hi,
This is a reminder message to assign an extra build label to this Pull Request if needed.
By default, this PR will be build with minimal build options (URDF support and Python bindings)
The possible extra labels are:

  • build_collision (build Pinocchio with coal support)
  • build_casadi (build Pinocchio with CasADi support)
  • build_autodiff (build Pinocchio with CppAD support)
  • build_codegen (build Pinocchio with CppADCodeGen support)
  • build_extra (build Pinocchio with extra algorithms)
  • build_mpfr (build Pinocchio with Boost.Multiprecision support)
  • build_sdf (build Pinocchio with SDF parser)
  • build_accelerate (build Pinocchio with APPLE Accelerate framework support)
  • build_all (build Pinocchio with ALL the options stated above)

Thanks.
The Pinocchio development team.

@jcarpent jcarpent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Sergim96 for this PR.
Could you split it into two parts:

  • a first PR where you have fixed the bindings (adding context, Scalar, etc.).
  • a second one for support of float32?

Thanks in advance,
Best,
Justin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants