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 namespace armarx::RemoteGui
25 {
26  detail::GroupBoxBuilder
27  makeConfigGui(const std::string& name,
28  const NJointCartesianWaypointControllerRuntimeConfig& val)
29  {
30  detail::GroupBoxBuilder builder = makeConfigGui(name, val.wpCfg);
31  auto& cs = builder.child(0)->children;
32 
33  cs.emplace_back(RemoteGui::makeTextLabel("Force limit:"));
34  cs.emplace_back(RemoteGui::makeFloatSpinBox(name + "_forceThreshold")
35  .min(-1)
36  .max(1000)
37  .value(val.forceThreshold)
38  .decimals(3));
39  cs.emplace_back(RemoteGui::makeCheckBox(name + "_forceThresholdInRobotRootZ")
40  .value(val.forceThresholdInRobotRootZ)
41  .label("Threshold only in root z"));
42 
43 
44  cs.emplace_back(new RemoteGui::Widget);
45  cs.emplace_back(RemoteGui::makeCheckBox(name + "_optimizeNullspaceIfTargetWasReached")
46  .value(val.optimizeNullspaceIfTargetWasReached)
47  .label("Optimize nullspace if target was reached"));
48  cs.emplace_back(new RemoteGui::HSpacer);
49 
50  return builder;
51  }
52 
53  void
54  getValueFromMap(NJointCartesianWaypointControllerRuntimeConfig& cfg,
56  std::string const& name)
57  {
58  getValueFromMap(cfg.wpCfg, values, name);
59  getValueFromMap(cfg.forceThreshold, values, name + "_forceThreshold");
61  cfg.forceThresholdInRobotRootZ, values, name + "_forceThresholdInRobotRootZ");
62  getValueFromMap(cfg.optimizeNullspaceIfTargetWasReached,
63  values,
64  name + "_optimizeNullspaceIfTargetWasReached");
65  }
66 } // namespace armarx::RemoteGui
armarx::RemoteGui::detail::GroupBoxBuilder
Definition: LayoutWidgets.h:166
armarx::RemoteGui::detail::ChildrenMixin::child
Derived & child(WidgetPtr const &child)
Definition: LayoutWidgets.h:43
armarx::RemoteGui
Definition: LightweightRemoteGuiComponentPlugin.h:30
armarx::max
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:267
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::RemoteGui::makeTextLabel
detail::LabelBuilder makeTextLabel(std::string const &text)
Definition: StaticWidgets.h:22
armarx::RemoteGui::ValueMap
std::map< std::string, ValueVariant > ValueMap
Definition: RemoteGuiVisitors.h:41
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::RemoteGui::makeCheckBox
detail::CheckBoxBuilder makeCheckBox(std::string const &name)
Definition: BoolWidgets.h:26
armarx::RemoteGui::detail::ChildrenMixin::children
Derived & children(std::vector< WidgetPtr > const &children)
Definition: LayoutWidgets.h:36
RemoteGui.h
armarx::min
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:294
armarx::RemoteGui::makeFloatSpinBox
detail::FloatSpinBoxBuilder makeFloatSpinBox(std::string const &name)
Definition: FloatWidgets.h:52
armarx::RemoteGui::getValueFromMap
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:13
armarx::RemoteGui::makeConfigGui
requires isAronGenerated< AronStructT > detail::GroupBoxBuilder makeConfigGui(const std::string &name, const AronStructT &val)
Definition: RemoteGui.h:41