From 72f06da86754744a75c0b328ca3c11049a9a28b2 Mon Sep 17 00:00:00 2001 From: Your Name <you@example.com> Date: Fri, 10 Feb 2023 14:01:17 +0100 Subject: [PATCH] fix: Armar6Converter: checking type in forceTorque extra (issue on ARMAR-DE) --- .../converters/Armar6Converter.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/RobotAPI/libraries/armem_robot_state/server/proprioception/converters/Armar6Converter.cpp b/source/RobotAPI/libraries/armem_robot_state/server/proprioception/converters/Armar6Converter.cpp index 02325df8c..4dda540b2 100644 --- a/source/RobotAPI/libraries/armem_robot_state/server/proprioception/converters/Armar6Converter.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/server/proprioception/converters/Armar6Converter.cpp @@ -164,7 +164,23 @@ namespace armarx::armem::server::robot_state::proprioception std::string key = split.size() == 4 ? (fieldName + "." + split.at(3)) : fieldName; - dto.extra[key] = getValueAs<float>(value); + + switch (value.entry.type) + { + case RobotUnitDataStreaming::NodeTypeFloat: + dto.extra[key] = getValueAs<float>(value); + break; + case RobotUnitDataStreaming::NodeTypeInt: + dto.extra[key] = getValueAs<int>(value); + break; + case RobotUnitDataStreaming::NodeTypeLong: + dto.extra[key] = getValueAs<long>(value); + break; + default: + ARMARX_DEBUG << "Cannot handle extra field '" << key << "' of type " + << RobotUnitDataStreaming::DataEntryNames.to_name(value.entry.type); + break; + } } } -- GitLab