From ba8b41fed92330e32a91677255adf0ce98d0dd0c Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Tue, 6 Feb 2024 16:41:10 +0100 Subject: [PATCH 1/3] Fix bug on memory allocation. --- toolbox/library/src/ForwardKinematics.cpp | 4 ++-- toolbox/library/src/RelativeTransform.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/toolbox/library/src/ForwardKinematics.cpp b/toolbox/library/src/ForwardKinematics.cpp index fcdce0fdb..aa9365fb0 100644 --- a/toolbox/library/src/ForwardKinematics.cpp +++ b/toolbox/library/src/ForwardKinematics.cpp @@ -227,8 +227,8 @@ bool ForwardKinematics::output(const BlockInformation* blockInfo) } // Allocate objects for row-major -> col-major conversion - Map world_H_frame_RowMajor = - toEigen(world_H_frame.asHomogeneousTransform()); + const iDynTree::Matrix4x4 world_H_frame_asHomogeneous = world_H_frame.asHomogeneousTransform(); + Map world_H_frame_RowMajor = toEigen(world_H_frame_asHomogeneous); Map world_H_frame_ColMajor(output->getBuffer(), 4, 4); // Forward the buffer to Simulink transforming it to ColMajor diff --git a/toolbox/library/src/RelativeTransform.cpp b/toolbox/library/src/RelativeTransform.cpp index 0b44c3152..e7e2c0947 100644 --- a/toolbox/library/src/RelativeTransform.cpp +++ b/toolbox/library/src/RelativeTransform.cpp @@ -235,8 +235,9 @@ bool RelativeTransform::output(const BlockInformation* blockInfo) } // Allocate objects for row-major -> col-major conversion - Map frame1_H_frame2_RowMajor = - toEigen(frame1_H_frame2.asHomogeneousTransform()); + const iDynTree::Matrix4x4 frame1_H_frame2_asHomogeneous = + frame1_H_frame2.asHomogeneousTransform(); + Map frame1_H_frame2_RowMajor = toEigen(frame1_H_frame2_asHomogeneous); Map frame1_H_frame2_ColMajor(output->getBuffer(), 4, 4); // Forward the buffer to Simulink transforming it to ColMajor From 6239f727bb3f83c7bff7e3a47e98b7f43e08d64c Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 6 Feb 2024 16:57:02 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fe983f5f..6db837ccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ The format of this document is based on [Keep a Changelog](https://keepachangelo ## [unreleased] +## [5.6.1] - 2023-02-06 + +## Fixed + +- Fix memory allocation bug in ForwardKinematics and RelativeTransform blocks (https://github.com/robotology/wb-toolbox/pull/243). + ## [5.6.0] - 2022-10-21 ### Changed From 8425b7c345a4bfe31e3e2d37f3c8a98b4defb8ba Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 6 Feb 2024 16:59:36 +0100 Subject: [PATCH 3/3] Bump version to 5.6.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc97d4048..79a1e9a6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # GNU Lesser General Public License v2.1 or any later version. cmake_minimum_required(VERSION 3.5) -project(WB-Toolbox LANGUAGES CXX VERSION 5.6.0) +project(WB-Toolbox LANGUAGES CXX VERSION 5.6.1) if(WBT_BUILD_DOCS) add_subdirectory(doc)