~ruther/guix-local

c912d63eaefeb6ff1064b2004671233a2e55af23 — Matthew Elwin 10 months ago 897f1f0
gnu: Add python-orocos-kinematics-dynamics.

* gnu/packages/engineering.scm (python-orocos-kinematics-dynamics): New variable.

Change-Id: I257d63b61d8fab0fdfdf27dea59f1f89c8667f35
Reviewed-by: Cayetano Santos <csantosb@inventati.org>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>

Change-Id: I8cc0b705c81c191ede7624062bd1e62afe5e340b
1 files changed, 47 insertions(+), 0 deletions(-)

M gnu/packages/engineering.scm
M gnu/packages/engineering.scm => gnu/packages/engineering.scm +47 -0
@@ 5597,3 5597,50 @@ towards field theory.")
and representations for kinematic structures and their inverse and
forward kinematics solvers.")
      (license license:lgpl2.1+))))

(define-public python-orocos-kinematics-dynamics
  (package
    (inherit orocos-kinematics-dynamics)
    (name "python-orocos-kinematics-dynamics")
    (source
     (origin
       (inherit (package-source orocos-kinematics-dynamics))
       (snippet '(begin
                   (substitute* "python_orocos_kdl/CMakeLists.txt"
                     ;; Use the system pybind11 instead of the bundled version
                     (("add_subdirectory\\(pybind11\\)")
                      "find_package(pybind11)")
                     ;; change debian-specific python install directory
                     (("dist-packages")
                      "site-packages"))
                   ;; ROS 1 uses some dynamic attributes, which are
                   ;; disabled by default in pybind11. No harm in enabling them
                   ;; See "https://github.com/ros2/geometry2/issues/624
                   ;; and https://pybind11.readthedocs.io/en/stable/classes.html
                   ;; #dynamic-attributes <Both accessed June 1 2025>
                   (substitute* "python_orocos_kdl/PyKDL/frames.cpp"
                     (("m, \"Vector\"")
                      "m, \"Vector\", py::dynamic_attr()")
                     (("m, \"Frame\"")
                      "m, \"Frame\", py::dynamic_attr()")
                     (("m, \"Twist\"")
                      "m, \"Twist\", py::dynamic_attr()")
                     (("m, \"Wrench\"")
                      "m, \"Wrench\", py::dynamic_attr()"))))))
    (native-inputs (list python pybind11 python-psutil))
    (inputs (list orocos-kinematics-dynamics))
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'chdir
            (lambda _
              (chdir "python_orocos_kdl")))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (setenv "PYTHONPATH" "./")
              (when tests?
                (invoke "python3"
                        "../python_orocos_kdl/tests/PyKDLtest.py")))))))
    (synopsis "Python bindings for orocos-kinematics-dynamics")
    (description "Python bindings for orocos-kinematics-dynamics.")))