From da9cbb1541b33380691bdcfc8413efcfb6b3ddd5 Mon Sep 17 00:00:00 2001 From: Fabian Reister <fabian.reister@kit.edu> Date: Tue, 11 May 2021 08:20:06 +0200 Subject: [PATCH] JointState aron --- .../armem_robot_state/aron/JointState.xml | 14 +++++++++ .../armem_robot_state/aron_conversions.cpp | 19 ++++++++++++ .../armem_robot_state/aron_conversions.h | 31 ++++++++++++++++++- .../libraries/armem_robot_state/types.h | 6 ++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 source/RobotAPI/libraries/armem_robot_state/aron/JointState.xml diff --git a/source/RobotAPI/libraries/armem_robot_state/aron/JointState.xml b/source/RobotAPI/libraries/armem_robot_state/aron/JointState.xml new file mode 100644 index 000000000..c7b78a90c --- /dev/null +++ b/source/RobotAPI/libraries/armem_robot_state/aron/JointState.xml @@ -0,0 +1,14 @@ +<!--This class contains the data structure for ObjectPose --> +<?xml version="1.0" encoding="UTF-8" ?> +<AronTypeDefinition> + <GenerateTypes> + <Object name="armarx::armem::arondto::JointState"> + <ObjectChild key='name'> + <String/> + </ObjectChild> + <ObjectChild key='position'> + <Float /> + </ObjectChild> + </Object> + </GenerateTypes> +</AronTypeDefinition> diff --git a/source/RobotAPI/libraries/armem_robot_state/aron_conversions.cpp b/source/RobotAPI/libraries/armem_robot_state/aron_conversions.cpp index fbca67117..dc30cbeb4 100644 --- a/source/RobotAPI/libraries/armem_robot_state/aron_conversions.cpp +++ b/source/RobotAPI/libraries/armem_robot_state/aron_conversions.cpp @@ -8,6 +8,7 @@ // RobotAPI #include <RobotAPI/libraries/armem_robot_state/aron/Transform.aron.generated.h> +#include <RobotAPI/libraries/armem_robot_state/aron/JointState.aron.generated.h> #include <RobotAPI/libraries/aron/common/aron_conversions.h> @@ -16,6 +17,8 @@ namespace armarx::armem { + /* Transform */ + void fromAron(const arondto::Transform& dto, robot_state::Transform& bo) { fromAron(dto.header, bo.header); @@ -28,6 +31,8 @@ namespace armarx::armem aron::toAron(dto.transform, bo.transform); } + /* TransformHeader */ + void toAron(arondto::TransformHeader& dto, const robot_state::TransformHeader& bo) { aron::toAron(dto.parentFrame, bo.parentFrame); @@ -44,4 +49,18 @@ namespace armarx::armem aron::fromAron(dto.timestamp, bo.timestamp); } + /* JointState */ + + void fromAron(const arondto::JointState& dto, robot_state::JointState& bo) + { + aron::fromAron(dto.name, bo.name); + aron::fromAron(dto.position, bo.position); + } + + void toAron(arondto::JointState& dto, const robot_state::JointState& bo) + { + aron::toAron(dto.name, bo.name); + aron::toAron(dto.position, bo.position); + } + } // namespace armarx::armem diff --git a/source/RobotAPI/libraries/armem_robot_state/aron_conversions.h b/source/RobotAPI/libraries/armem_robot_state/aron_conversions.h index d266717dc..202a81f08 100644 --- a/source/RobotAPI/libraries/armem_robot_state/aron_conversions.h +++ b/source/RobotAPI/libraries/armem_robot_state/aron_conversions.h @@ -1,5 +1,25 @@ -#pragma once +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @author Fabian Reister ( fabian dot reister at kit dot edu ) + * @date 2021 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ +#pragma once namespace armarx::armem { @@ -7,12 +27,18 @@ namespace armarx::armem { struct Transform; struct TransformHeader; + + struct JointState; + } // namespace robot_state namespace arondto { struct Transform; struct TransformHeader; + + struct JointState; + } // namespace arondto void fromAron(const arondto::Transform& dto, robot_state::Transform& bo); @@ -21,4 +47,7 @@ namespace armarx::armem void fromAron(const arondto::TransformHeader& dto, robot_state::TransformHeader& bo); void toAron(arondto::TransformHeader& dto, const robot_state::TransformHeader& bo); + void fromAron(const arondto::JointState& dto, robot_state::JointState& bo); + void toAron(arondto::JointState& dto, const robot_state::JointState& bo); + } // namespace armarx::armem \ No newline at end of file diff --git a/source/RobotAPI/libraries/armem_robot_state/types.h b/source/RobotAPI/libraries/armem_robot_state/types.h index 3edaee80f..43408df40 100644 --- a/source/RobotAPI/libraries/armem_robot_state/types.h +++ b/source/RobotAPI/libraries/armem_robot_state/types.h @@ -23,4 +23,10 @@ namespace armarx::armem::robot_state EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; + struct JointState + { + std::string name; + float position; + }; + } // namespace armarx::armem::robot_state -- GitLab