diff --git a/flake.lock b/flake.lock index d77b63b..3d2f99d 100644 --- a/flake.lock +++ b/flake.lock @@ -264,6 +264,26 @@ "type": "github" } }, + "hpp-core": { + "inputs": { + "gepetto": [ + "gepetto" + ] + }, + "locked": { + "lastModified": 1786116273, + "narHash": "sha256-WO9Xn1TYXQB6qrnluYYAYN6990YFEionBZtLsoJ6hSE=", + "owner": "humanoid-path-planner", + "repo": "hpp-core", + "rev": "13a5dffb644e50a71b53d0541bc99b0d65823202", + "type": "github" + }, + "original": { + "owner": "humanoid-path-planner", + "repo": "hpp-core", + "type": "github" + } + }, "nix-ros-overlay": { "inputs": { "flake-utils": "flake-utils", @@ -423,7 +443,8 @@ }, "root": { "inputs": { - "gepetto": "gepetto" + "gepetto": "gepetto", + "hpp-core": "hpp-core" } }, "rosdistro": { diff --git a/flake.nix b/flake.nix index a044cc8..dbc89bb 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,20 @@ { description = "python bindings for HPP, based on boost python"; - inputs.gepetto.url = "github:gepetto/nix"; + inputs = { + gepetto.url = "github:gepetto/nix"; + hpp-core = { + url = "github:humanoid-path-planner/hpp-core"; + inputs.gepetto.follows = "gepetto"; + }; + }; outputs = inputs: inputs.gepetto.lib.mkFlakoboros inputs ( { lib, ... }: { + overlays = [ inputs.hpp-core.overlays.flakoboros ]; pyOverrideAttrs.hpp-python = { src = lib.fileset.toSource { root = ./.; diff --git a/src/pyhpp/core/path-validation.cc b/src/pyhpp/core/path-validation.cc index 6daf7dd..7bfec8d 100644 --- a/src/pyhpp/core/path-validation.cc +++ b/src/pyhpp/core/path-validation.cc @@ -133,6 +133,29 @@ struct Progressive : PathValidation { tolerance) {} }; +struct ProgressiveWrapper { + static hpp::core::value_type getTimeOut(PathValidation* pv) { + return HPP_DYNAMIC_PTR_CAST(hpp::core::continuousValidation::Progressive, + pv->obj) + ->timeOut(); + } + static void setTimeOut(PathValidation* pv, + const hpp::core::value_type& timeOut) { + auto progressive = HPP_DYNAMIC_PTR_CAST( + hpp::core::continuousValidation::Progressive, pv->obj); + progressive->timeOut(timeOut); + + pv->factory = [timeOut](const hpp::core::DevicePtr_t& robot, + const hpp::core::value_type& tolerance) + -> hpp::core::PathValidationPtr_t { + auto result = hpp::core::continuousValidation::Progressive::create( + robot, tolerance); + result->timeOut(timeOut); + return result; + }; + } +}; + struct Dichotomy : PathValidation { Dichotomy(const hpp::core::DevicePtr_t& robot, const hpp::core::value_type& tolerance) @@ -184,7 +207,11 @@ void exposePathValidation() { class_>( "Progressive", "Create a progressive continuous path validation.", init( - (arg("robot"), arg("tolerance")))); + (arg("robot"), arg("tolerance")))) + .def("timeOut", &pathValidation::ProgressiveWrapper::getTimeOut, + "Get wall-clock timeout (seconds) for path validation.") + .def("timeOut", &pathValidation::ProgressiveWrapper::setTimeOut, + "Set wall-clock timeout (seconds) for path validation."); class_>( "Dichotomy", "Create a dichotomy-based continuous path validation.", init(