RemoteGui.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package RobotAPI::ArmarXObjects::ControllerUIUtility
17 * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * @date 2019
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#include "RemoteGui.h"
24
25namespace armarx::RemoteGui
26{
28 makeConfigGui(const std::string& name,
29 const NJointCartesianWaypointControllerRuntimeConfig& val)
30 {
31 detail::GroupBoxBuilder builder = makeConfigGui(name, val.wpCfg);
32 auto& cs = builder.child(0)->children;
33
34 cs.emplace_back(RemoteGui::makeTextLabel("Force limit:"));
35 cs.emplace_back(RemoteGui::makeFloatSpinBox(name + "_forceThreshold")
36 .min(-1)
37 .max(1000)
38 .value(val.forceThreshold)
39 .decimals(3));
40 cs.emplace_back(RemoteGui::makeCheckBox(name + "_forceThresholdInRobotRootZ")
41 .value(val.forceThresholdInRobotRootZ)
42 .label("Threshold only in root z"));
43
44
45 cs.emplace_back(new RemoteGui::Widget);
46 cs.emplace_back(RemoteGui::makeCheckBox(name + "_optimizeNullspaceIfTargetWasReached")
47 .value(val.optimizeNullspaceIfTargetWasReached)
48 .label("Optimize nullspace if target was reached"));
49 cs.emplace_back(new RemoteGui::HSpacer);
50
51 return builder;
52 }
53
54 void
55 getValueFromMap(NJointCartesianWaypointControllerRuntimeConfig& cfg,
56 RemoteGui::ValueMap const& values,
57 std::string const& name)
58 {
59 getValueFromMap(cfg.wpCfg, values, name);
60 getValueFromMap(cfg.forceThreshold, values, name + "_forceThreshold");
62 cfg.forceThresholdInRobotRootZ, values, name + "_forceThresholdInRobotRootZ");
63 getValueFromMap(cfg.optimizeNullspaceIfTargetWasReached,
64 values,
65 name + "_optimizeNullspaceIfTargetWasReached");
66 }
67} // namespace armarx::RemoteGui
detail::CheckBoxBuilder makeCheckBox(std::string const &name)
Definition BoolWidgets.h:27
detail::GroupBoxBuilder makeConfigGui(const std::string &name, const AronStructT &val)
Definition RemoteGui.h:41
detail::FloatSpinBoxBuilder makeFloatSpinBox(std::string const &name)
std::map< std::string, ValueVariant > ValueMap
detail::LabelBuilder makeTextLabel(std::string const &text)
std::enable_if_t< meta::cfg::gui_definition_enabled_v< T >, void > getValueFromMap(T &cfg, RemoteGui::ValueMap const &values, std::string const &name)
Definition GetValue.h:12
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
Derived & children(std::vector< WidgetPtr > const &children)
Derived & child(WidgetPtr const &child)