From f912b9d86516bd2bd93502e0ab9dc3b7fe6f2e0c Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Wed, 17 Apr 2024 14:56:01 +0200 Subject: [PATCH] fix: avoid function renaming --- .../translators/message_readers.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/modulo_core/include/modulo_core/translators/message_readers.hpp b/source/modulo_core/include/modulo_core/translators/message_readers.hpp index ccbd98fa7..56a5170f2 100644 --- a/source/modulo_core/include/modulo_core/translators/message_readers.hpp +++ b/source/modulo_core/include/modulo_core/translators/message_readers.hpp @@ -257,8 +257,9 @@ inline void safe_spatial_state_conversion( * @param conversion_callback A callback function taking parameters of type StateT and NewStateT, where the * referenced StateT instance can be modified as needed from the NewStateT value */ +// FIXME(#77): rename this upon modulo 5.0 template -inline void safe_state_with_names_conversion( +inline void safe_joint_state_conversion( std::shared_ptr& state, std::shared_ptr& new_state, std::function conversion_callback = {} ) { @@ -400,22 +401,22 @@ inline void read_message(std::shared_ptr& state, co case StateType::JOINT_STATE: { auto derived_state = safe_dynamic_pointer_cast(state); if (new_state->get_type() == StateType::JOINT_POSITIONS) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointState& a, const JointPositions& b) { a.set_positions(b.get_positions()); }); } else if (new_state->get_type() == StateType::JOINT_VELOCITIES) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointState& a, const JointVelocities& b) { a.set_velocities(b.get_velocities()); }); } else if (new_state->get_type() == StateType::JOINT_ACCELERATIONS) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointState& a, const JointAccelerations& b) { a.set_accelerations(b.get_accelerations()); }); } else if (new_state->get_type() == StateType::JOINT_TORQUES) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointState& a, const JointTorques& b) { a.set_torques(b.get_torques()); }); @@ -426,7 +427,7 @@ inline void read_message(std::shared_ptr& state, co } case StateType::JOINT_POSITIONS: { if (new_state->get_type() == StateType::JOINT_STATE) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointPositions& a, const JointState& b) { a.set_positions(b.get_positions()); }); @@ -437,7 +438,7 @@ inline void read_message(std::shared_ptr& state, co } case StateType::JOINT_VELOCITIES: { if (new_state->get_type() == StateType::JOINT_STATE) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointVelocities& a, const JointState& b) { a.set_velocities(b.get_velocities()); }); @@ -448,7 +449,7 @@ inline void read_message(std::shared_ptr& state, co } case StateType::JOINT_ACCELERATIONS: { if (new_state->get_type() == StateType::JOINT_STATE) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointAccelerations& a, const JointState& b) { a.set_accelerations(b.get_accelerations()); }); @@ -459,7 +460,7 @@ inline void read_message(std::shared_ptr& state, co } case StateType::JOINT_TORQUES: { if (new_state->get_type() == StateType::JOINT_STATE) { - safe_state_with_names_conversion( + safe_joint_state_conversion( state, new_state, [](JointTorques& a, const JointState& b) { a.set_torques(b.get_torques()); });