From abf90fb801765f3fda76b1f0f302fd60c67dc1f7 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 3 Jan 2025 12:02:06 +0100 Subject: [PATCH 1/4] core: Fix aba explicit template instantiation core: Fix typo --- include/pinocchio/algorithm/aba.txx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pinocchio/algorithm/aba.txx b/include/pinocchio/algorithm/aba.txx index 848a8ffd4e..3152c99cdd 100644 --- a/include/pinocchio/algorithm/aba.txx +++ b/include/pinocchio/algorithm/aba.txx @@ -7,7 +7,7 @@ namespace pinocchio { - extern template PINOCCHIO_EXPLICIT_INSTANTIATION_DEFINITION_DLLAPI const context::VectorXs & aba< + extern template PINOCCHIO_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI const context::VectorXs & aba< context::Scalar, context::Options, JointCollectionDefaultTpl, @@ -21,7 +21,7 @@ namespace pinocchio const Eigen::MatrixBase> &, const Convention); - extern template PINOCCHIO_EXPLICIT_INSTANTIATION_DEFINITION_DLLAPI const context::VectorXs & aba< + extern template PINOCCHIO_EXPLICIT_INSTANTIATION_DECLARATION_DLLAPI const context::VectorXs & aba< context::Scalar, context::Options, JointCollectionDefaultTpl, From 0fea7e365fc722f8d91b2d46e1632454d7697aee Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 3 Jan 2025 12:03:51 +0100 Subject: [PATCH 2/4] changelog: Add entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af3cd68a2a..ce3db9aa0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Fix mjcf Euler angle parsing: use xyz as a default value for eulerseq compiler option ([#2526](https://github.com/stack-of-tasks/pinocchio/pull/2526)) - Add parsing meshes with vertices for MJCF format ([#2537](https://github.com/stack-of-tasks/pinocchio/pull/2537)) +- Fix aba explicit template instantiation ([#2541](https://github.com/stack-of-tasks/pinocchio/pull/2541)) ## [3.3.1] - 2024-12-13 From e6f517f5a662a109b8557e6bb26c93a0d5861b03 Mon Sep 17 00:00:00 2001 From: JafarAbdi Date: Tue, 31 Dec 2024 00:33:25 +0000 Subject: [PATCH 3/4] Improves MJCF unknown size vector parsing robustness --- include/pinocchio/parsers/mjcf/mjcf-graph.hpp | 5 ++- unittest/mjcf.cpp | 32 ++++++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/include/pinocchio/parsers/mjcf/mjcf-graph.hpp b/include/pinocchio/parsers/mjcf/mjcf-graph.hpp index 081a0cf35e..4960a24a68 100644 --- a/include/pinocchio/parsers/mjcf/mjcf-graph.hpp +++ b/include/pinocchio/parsers/mjcf/mjcf-graph.hpp @@ -549,7 +549,7 @@ namespace pinocchio inline std::istringstream getConfiguredStringStream(const std::string & str) { std::istringstream posStream(str); - posStream.exceptions(std::ios::failbit); + posStream.exceptions(std::ios::badbit); return posStream; } @@ -569,9 +569,8 @@ namespace pinocchio std::istringstream stream = getConfiguredStringStream(str); std::vector vector; double elem; - while (!stream.eof()) + while (stream >> elem) { - stream >> elem; vector.push_back(elem); } diff --git a/unittest/mjcf.cpp b/unittest/mjcf.cpp index 25c016accf..aa9a67acc7 100644 --- a/unittest/mjcf.cpp +++ b/unittest/mjcf.cpp @@ -8,6 +8,7 @@ #include "pinocchio/multibody/model.hpp" #include "pinocchio/parsers/mjcf.hpp" +#include "pinocchio/parsers/mjcf/mjcf-graph.hpp" #include "pinocchio/parsers/urdf.hpp" #include "pinocchio/algorithm/joint-configuration.hpp" @@ -923,7 +924,8 @@ BOOST_AUTO_TEST_CASE(adding_keyframes) + 0.988015 0 0.154359 0 + "/> )"); @@ -1398,4 +1400,32 @@ BOOST_AUTO_TEST_CASE(parse_mesh_with_vertices) } } +BOOST_AUTO_TEST_CASE(test_get_unknown_size_vector_from_stream) +{ + const auto v = pinocchio::mjcf::details::internal::getUnknownSizeVectorFromStream(""); + BOOST_CHECK(v.size() == 0); + + const auto v1 = pinocchio::mjcf::details::internal::getUnknownSizeVectorFromStream("1 2 3"); + BOOST_CHECK(v1.size() == 3); + Eigen::VectorXd expected(3); + expected << 1, 2, 3; + BOOST_CHECK(v1 == expected); + + const auto v2 = pinocchio::mjcf::details::internal::getUnknownSizeVectorFromStream(R"(1 2 3 + 4 5 6)"); + BOOST_CHECK(v2.size() == 6); + Eigen::VectorXd expected2(6); + expected2 << 1, 2, 3, 4, 5, 6; + BOOST_CHECK(v2 == expected2); + + const auto v3 = pinocchio::mjcf::details::internal::getUnknownSizeVectorFromStream(R"(1 2 3 + 4 5 6 + 7 8 9 + )"); + BOOST_CHECK(v3.size() == 9); + Eigen::VectorXd expected3(9); + expected3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; + BOOST_CHECK(v3 == expected3); +} + BOOST_AUTO_TEST_SUITE_END() From 61302b6f6b909684c74e6c4cf0fc77a52ac35bd8 Mon Sep 17 00:00:00 2001 From: JafarAbdi Date: Wed, 1 Jan 2025 00:55:42 +0000 Subject: [PATCH 4/4] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce3db9aa0b..640c592318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix mjcf Euler angle parsing: use xyz as a default value for eulerseq compiler option ([#2526](https://github.com/stack-of-tasks/pinocchio/pull/2526)) - Add parsing meshes with vertices for MJCF format ([#2537](https://github.com/stack-of-tasks/pinocchio/pull/2537)) - Fix aba explicit template instantiation ([#2541](https://github.com/stack-of-tasks/pinocchio/pull/2541)) +- Fix mjcf parsing of keyframe qpos with newlines ([#2535](https://github.com/stack-of-tasks/pinocchio/pull/2535)) ## [3.3.1] - 2024-12-13