diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 1ac391b..cc47550 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -1,6 +1,7 @@ -name: "Nix CI" +name: "CI - Nix" -on: [pull_request, push] +on: + push: jobs: tests: @@ -11,9 +12,9 @@ jobs: os: [ubuntu] steps: - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@main - - uses: DeterminateSystems/magic-nix-cache-action@main - - run: nix --accept-flake-config build -L - - run: nix --accept-flake-config run .#cachix push gepetto $(readlink result) - env: - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} + - uses: cachix/install-nix-action@v27 + - uses: cachix/cachix-action@v15 + with: + name: gepetto + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - run: nix build -L diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 11ed78c..961bed7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1 +1 @@ -include: http://rainboard.laas.fr/project/hpp-pinocchio/.gitlab-ci.yml +include: https://rainboard.laas.fr/project/hpp-pinocchio/.gitlab-ci.yml diff --git a/.mergify.yml b/.mergify.yml new file mode 100644 index 0000000..8e98970 --- /dev/null +++ b/.mergify.yml @@ -0,0 +1,11 @@ +pull_request_rules: + - name: merge automatically when CI passes and PR is approved + conditions: + - check-success = "gitlab-ci" + - check-success = "Nix build on ubuntu" + - check-success = "pre-commit.ci - pr" + - or: + - author = pre-commit-ci[bot] + - author = dependabot[bot] + actions: + merge: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d3c449..ae52b97 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ ci: autoupdate_branch: devel repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.0 + rev: v0.6.9 hooks: - id: ruff args: @@ -19,13 +19,13 @@ repos: - id: toml-sort-fix exclude: poetry.lock - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.7 + rev: v19.1.1 hooks: - id: clang-format args: - --style=Google - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-ast diff --git a/cmake b/cmake index 2bea127..4b829af 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 2bea127e8113a32f216ae7a7201e36a6e7c56cc2 +Subproject commit 4b829af01672f0a7d26b1ae8b69c828905e1e3dc diff --git a/default.nix b/default.nix deleted file mode 100644 index daae89a..0000000 --- a/default.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - lib, - stdenv, - cmake, - example-robot-data, - hpp-environments, - hpp-util, - pinocchio, -}: - -stdenv.mkDerivation { - pname = "hpp-pinocchio"; - version = "5.0.0"; - - src = lib.fileset.toSource { - root = ./.; - fileset = lib.fileset.unions [ - ./CMakeLists.txt - ./doc - ./include - ./package.xml - ./src - ./tests - ]; - }; - - strictDeps = true; - - nativeBuildInputs = [ cmake ]; - propagatedBuildInputs = [ - example-robot-data - hpp-environments - hpp-util - pinocchio - ]; - - doCheck = true; - - meta = { - description = "Wrapping of Pinocchio library into HPP"; - homepage = "https://github.com/humanoid-path-planner/hpp-pinocchio"; - license = lib.licenses.bsd2; - maintainers = [ lib.maintainers.nim65s ]; - }; -} diff --git a/flake.lock b/flake.lock index 4722a90..291df13 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1717285511, - "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "lastModified": 1719877454, + "narHash": "sha256-g5N1yyOSsPNiOlFfkuI/wcUjmtah+nxdImJqrSATjOU=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "rev": "4e3583423212f9303aa1a6337f8dffb415920e4f", "type": "github" }, "original": { @@ -20,66 +20,17 @@ "type": "github" } }, - "hpp-environments": { - "inputs": { - "flake-parts": [ - "flake-parts" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719580427, - "narHash": "sha256-T76zgTJrGm7maKBPwgX+FgQ7MPN7NoLvdZvzARPo9V0=", - "owner": "humanoid-path-planner", - "repo": "hpp-environments", - "rev": "1c727bcc85145a1f5236357fa73df5a183a31f04", - "type": "github" - }, - "original": { - "owner": "humanoid-path-planner", - "ref": "release/5.1.0", - "repo": "hpp-environments", - "type": "github" - } - }, - "hpp-util": { - "inputs": { - "flake-parts": [ - "flake-parts" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719580825, - "narHash": "sha256-trfl8A+P7a1gnACnTXNK98TYWWDAOM3PKfkXxpC3X/8=", - "owner": "humanoid-path-planner", - "repo": "hpp-util", - "rev": "0504f15818a92c7a257cd6b60cd8b6092bd6dbfa", - "type": "github" - }, - "original": { - "owner": "humanoid-path-planner", - "ref": "release/5.1.0", - "repo": "hpp-util", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1719575122, - "narHash": "sha256-1x3SNH6GtWgpHmhxO4pCz6nidxjCAheF0FpSXSjqRrg=", - "owner": "nim65s", + "lastModified": 1727174734, + "narHash": "sha256-xa3TynMF5vaWonmTOg/Ejc1Fmo0GkQnCaVRVkBc3z2I=", + "owner": "gepetto", "repo": "nixpkgs", - "rev": "5206f72d0fadec6f15e6130a86c0695ceb5ec92d", + "rev": "0ad139a0e4372abc12320c8c92ee90e0e5e296e1", "type": "github" }, "original": { - "owner": "nim65s", - "ref": "gepetto", + "owner": "gepetto", "repo": "nixpkgs", "type": "github" } @@ -87,8 +38,6 @@ "root": { "inputs": { "flake-parts": "flake-parts", - "hpp-environments": "hpp-environments", - "hpp-util": "hpp-util", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 8a4623d..3326d48 100644 --- a/flake.nix +++ b/flake.nix @@ -1,33 +1,17 @@ { description = "Wrapping of Pinocchio library into HPP"; - nixConfig = { - extra-substituters = [ "https://gepetto.cachix.org" ]; - extra-trusted-public-keys = [ "gepetto.cachix.org-1:toswMl31VewC0jGkN6+gOelO2Yom0SOHzPwJMY2XiDY=" ]; - }; - inputs = { - nixpkgs.url = "github:nim65s/nixpkgs/gepetto"; + nixpkgs.url = "github:gepetto/nixpkgs"; flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; - hpp-environments = { - url = "github:humanoid-path-planner/hpp-environments/release/5.1.0"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-parts.follows = "flake-parts"; - }; - hpp-util = { - url = "github:humanoid-path-planner/hpp-util/release/5.1.0"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-parts.follows = "flake-parts"; - }; }; outputs = - inputs@{ flake-parts, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - imports = [ ]; + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" "aarch64-linux" @@ -35,21 +19,25 @@ "x86_64-darwin" ]; perSystem = + { pkgs, self', ... }: { - self', - pkgs, - system, - ... - }: - { + devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; }; packages = { - inherit (pkgs) cachix; - default = pkgs.callPackage ./. { - hpp-environments = inputs.hpp-environments.packages.${system}.default; - hpp-util = inputs.hpp-util.packages.${system}.default; - }; + default = self'.packages.hpp-pinocchio; + hpp-pinocchio = pkgs.hpp-pinocchio.overrideAttrs (_: { + src = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./CMakeLists.txt + ./doc + ./include + ./package.xml + ./src + ./tests + ]; + }; + }); }; - devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; }; }; }; } diff --git a/include/hpp/pinocchio/util.hh b/include/hpp/pinocchio/util.hh index 57904d8..24976f2 100644 --- a/include/hpp/pinocchio/util.hh +++ b/include/hpp/pinocchio/util.hh @@ -126,32 +126,32 @@ std::ostream& operator<<(std::ostream& os, const PrettyPrint pp) { /// Generic implementation for Eigen objects template -struct HPP_PINOCCHIO_DLLAPI prettyPrintEigen { - static inline std::ostream& run(std::ostream& os, const Derived& M) { - enum { - Condensed = ((Option & OutputFormatBits) == OneLineOutput) || - ((Option & OutputFormatBits) == CondensedOutput) - }; - static const Eigen::IOFormat mfmt_py = - eigen_format::run(); - static const Eigen::IOFormat vfmt_py = - eigen_format::run(); - static const Eigen::IOFormat mfmt_raw = - eigen_format::run(); - static const Eigen::IOFormat vfmt_raw = - eigen_format::run(); - bool use_py_fmt = (getpythonformat(os) != 0); - const Eigen::IOFormat& fmt = - (Derived::IsVectorAtCompileTime ? (use_py_fmt ? vfmt_py : vfmt_raw) - : (use_py_fmt ? mfmt_py : mfmt_raw)); - bool transpose = (Derived::ColsAtCompileTime == 1); - - if (transpose) - return os << M.transpose().format(fmt); - else - return os << M.format(fmt); - } -}; +struct HPP_PINOCCHIO_DLLAPI prettyPrintEigen{ + static inline std::ostream & + run(std::ostream & os, const Derived& M){ + enum {Condensed = ((Option & OutputFormatBits) == OneLineOutput) || + ((Option & OutputFormatBits) == CondensedOutput)}; +static const Eigen::IOFormat mfmt_py = + eigen_format::run(); +static const Eigen::IOFormat vfmt_py = + eigen_format::run(); +static const Eigen::IOFormat mfmt_raw = + eigen_format::run(); +static const Eigen::IOFormat vfmt_raw = + eigen_format::run(); +bool use_py_fmt = (getpythonformat(os) != 0); +const Eigen::IOFormat& fmt = + (Derived::IsVectorAtCompileTime ? (use_py_fmt ? vfmt_py : vfmt_raw) + : (use_py_fmt ? mfmt_py : mfmt_raw)); +bool transpose = (Derived::ColsAtCompileTime == 1); + +if (transpose) + return os << M.transpose().format(fmt); +else + return os << M.format(fmt); +} // namespace hpp +} +; /// FIXME All eigen object must be manually specialized as follow... /// Pretty printer for Eigen::Matrix diff --git a/src/joint.cc b/src/joint.cc index 13fed5e..1ef5712 100644 --- a/src/joint.cc +++ b/src/joint.cc @@ -277,10 +277,11 @@ value_type computeMaximalDistanceToParent( const Model& model, const ::pinocchio::JointModelPrismaticTpl& jmodel, const SE3& jointPlacement) { - return computeMaximalDistanceToParentForAlignedTranslation< - Axis == 0, Axis == 1, Axis == 2>( - model.lowerPositionLimit.segment<1>(jmodel.idx_q()), - model.upperPositionLimit.segment<1>(jmodel.idx_q()), jointPlacement); + return computeMaximalDistanceToParentForAlignedTranslation < Axis == 0, + Axis == 1, + Axis == 2 > (model.lowerPositionLimit.segment<1>(jmodel.idx_q()), + model.upperPositionLimit.segment<1>(jmodel.idx_q()), + jointPlacement); } template