From 76bd6f22900387a4c7d352646c626e065ac75a0e Mon Sep 17 00:00:00 2001 From: robdekon <kevin.hitzler@kit.edu> Date: Wed, 18 Sep 2019 15:48:45 +0200 Subject: [PATCH] Add NJointCartesianWaypointControllerConfig/RemoteGui.h --- .../ControllerUIUtility/CMakeLists.txt | 2 + .../RemoteGui.cpp | 52 +++++++++++++++++++ .../RemoteGui.h | 39 ++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.cpp create mode 100644 source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.h diff --git a/source/RobotAPI/libraries/ControllerUIUtility/CMakeLists.txt b/source/RobotAPI/libraries/ControllerUIUtility/CMakeLists.txt index cb553d815..9f6635157 100644 --- a/source/RobotAPI/libraries/ControllerUIUtility/CMakeLists.txt +++ b/source/RobotAPI/libraries/ControllerUIUtility/CMakeLists.txt @@ -7,9 +7,11 @@ set(LIBS ArmarXCore RobotAPIInterfaces RemoteGui) set(LIB_FILES CartesianWaypointControllerConfig/RemoteGui.h + NJointCartesianWaypointControllerConfig/RemoteGui.h ) set(LIB_HEADERS CartesianWaypointControllerConfig/RemoteGui.cpp + NJointCartesianWaypointControllerConfig/RemoteGui.cpp ) armarx_add_library("${LIB_NAME}" "${LIB_FILES}" "${LIB_HEADERS}" "${LIBS}") diff --git a/source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.cpp b/source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.cpp new file mode 100644 index 000000000..2bd5c3cae --- /dev/null +++ b/source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.cpp @@ -0,0 +1,52 @@ +/* + * 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/>. + * + * @package RobotAPI::ArmarXObjects::ControllerUIUtility + * @author Raphael Grimm ( raphael dot grimm at kit dot edu ) + * @date 2019 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "RemoteGui.h" +namespace armarx::RemoteGui +{ + detail::GroupBoxBuilder makeConfigGui( + const std::string& name, + const CartesianWaypointControllerConfigWithForceLimit& val) + { + detail::GroupBoxBuilder builder = makeConfigGui(name, val.wpCfg); + auto& cs = builder.child(0)->children; + cs.emplace_back(RemoteGui::makeTextLabel("Force limit:")); + cs.emplace_back(RemoteGui::makeFloatSpinBox(name + "_forceThreshold") + .min(-1) + .max(1000) + .value(val.forceThreshold) + .decimals(3)); + cs.emplace_back(new RemoteGui::HSpacer); + return builder; + } + + template <> + CartesianWaypointControllerConfigWithForceLimit getValue<CartesianWaypointControllerConfigWithForceLimit>( + ValueMap const& values, + std::string const& name) + { + CartesianWaypointControllerConfigWithForceLimit cfg; + getValue(cfg.wpCfg, values, name); + getValue(cfg.forceThreshold, values, name + "_forceThreshold"); + return cfg; + } +} diff --git a/source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.h b/source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.h new file mode 100644 index 000000000..4951d5efa --- /dev/null +++ b/source/RobotAPI/libraries/ControllerUIUtility/NJointCartesianWaypointControllerConfig/RemoteGui.h @@ -0,0 +1,39 @@ +/* + * 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/>. + * + * @package RobotAPI::ArmarXObjects::ControllerUIUtility + * @author Raphael Grimm ( raphael dot grimm at kit dot edu ) + * @date 2019 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#pragma once + +#include "../CartesianWaypointControllerConfig/RemoteGui.h" +#include <RobotAPI/interface/units/RobotUnit/NJointCartesianWaypointController.h> + +//make +namespace armarx::RemoteGui +{ + detail::GroupBoxBuilder makeConfigGui( + const std::string& name, + const CartesianWaypointControllerConfigWithForceLimit& val); + + template <> + CartesianWaypointControllerConfigWithForceLimit getValue<CartesianWaypointControllerConfigWithForceLimit>( + ValueMap const& values, + std::string const& name); +} -- GitLab