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 0000000000000000000000000000000000000000..c7b78a90cfa452579dfea76227833b66c5befbe4 --- /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 fbca6711774de97e3d137901338fde776e6f2285..dc30cbeb47cfa5866eb86cd17134c2b1961a3faf 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 d266717dc729e8a09e4f96c3469eb96af38f347d..202a81f089702e07155232200911fa0e0afa197d 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 3edaee80f8696d844f1f5c90b299c0a54c503f93..43408df40c236f0fc4e877f1a04cd4a23ee818e3 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