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 
25 namespace armarx::RemoteGui
26 {
27  detail::GroupBoxBuilder
28  makeConfigGui(const std::string& name, const CartesianWaypointControllerConfig& val)
29  {
30  return RemoteGui::makeGroupBox(name).addChild(
32  .cols(10)
33 
34  .addChild(RemoteGui::makeTextLabel("Max accelerations:"))
35  .addChild(RemoteGui::makeTextLabel("Pos:"))
36  .addChild(RemoteGui::makeFloatSpinBox(name + "_maxAcc_Pos")
37  .min(0)
38  .max(10000)
39  .value(val.maxPositionAcceleration)
40  .decimals(3))
42  .addChild(RemoteGui::makeFloatSpinBox(name + "_maxAcc_Ori")
43  .min(0)
44  .max(10)
45  .value(val.maxOrientationAcceleration)
46  .decimals(3))
47  .addChild(RemoteGui::makeTextLabel("Nullspace:"))
48  .addChild(RemoteGui::makeFloatSpinBox(name + "_maxAcc_Null")
49  .min(0)
50  .max(10)
51  .value(val.maxNullspaceAcceleration)
52  .decimals(3))
53  .addChild(new RemoteGui::Widget())
54  .addChild(new RemoteGui::Widget())
55  .addChild(new RemoteGui::HSpacer)
56 
57  .addChild(RemoteGui::makeTextLabel("JointLimitAvoidance:"))
59  .addChild(RemoteGui::makeFloatSpinBox(name + "_JointLimitAvoidance_KP")
60  .min(0)
61  .max(10)
62  .value(val.kpJointLimitAvoidance)
63  .decimals(3))
65  .addChild(RemoteGui::makeFloatSpinBox(name + "_JointLimitAvoidance_Scale")
66  .min(0)
67  .max(10)
68  .value(val.jointLimitAvoidanceScale)
69  .decimals(3))
70  .addChild(new RemoteGui::Widget())
71  .addChild(new RemoteGui::Widget())
72  .addChild(new RemoteGui::Widget())
73  .addChild(new RemoteGui::Widget())
74  .addChild(new RemoteGui::HSpacer)
75 
76  .addChild(RemoteGui::makeTextLabel("Position:"))
78  .addChild(RemoteGui::makeFloatSpinBox(name + "_Thresholds_Pos_Near")
79  .min(0)
80  .max(1000)
81  .value(val.thresholdPositionNear)
82  .decimals(3))
84  .addChild(RemoteGui::makeFloatSpinBox(name + "_Thresholds_Pos_Reached")
85  .min(0)
86  .max(1000)
87  .value(val.thresholdPositionReached)
88  .decimals(3))
90  .addChild(RemoteGui::makeFloatSpinBox(name + "_Max_vel_pos")
91  .min(0)
92  .max(1000)
93  .value(val.maxPosVel)
94  .decimals(3))
96  .addChild(RemoteGui::makeFloatSpinBox(name + "_KP_pos")
97  .min(0)
98  .max(10)
99  .value(val.kpPos)
100  .decimals(3))
101  .addChild(new RemoteGui::HSpacer)
102 
103  .addChild(RemoteGui::makeTextLabel("Orientation:"))
105  .addChild(RemoteGui::makeFloatSpinBox(name + "_Thresholds_Ori_Near")
106  .min(0)
107  .max(3.14f)
108  .value(val.thresholdOrientationNear)
109  .decimals(3))
110  .addChild(RemoteGui::makeTextLabel("Reached:"))
111  .addChild(RemoteGui::makeFloatSpinBox(name + "_Thresholds_Ori_Reached")
112  .min(0)
113  .max(3.14f)
114  .value(val.thresholdOrientationReached)
115  .decimals(3))
116  .addChild(RemoteGui::makeTextLabel("Max vel:"))
117  .addChild(RemoteGui::makeFloatSpinBox(name + "_Max_vel_ori")
118  .min(0)
119  .max(31.4f)
120  .value(val.maxOriVel)
121  .decimals(3))
123  .addChild(RemoteGui::makeFloatSpinBox(name + "_KP_ori")
124  .min(0)
125  .max(10)
126  .value(val.kpOri)
127  .decimals(3))
128  .addChild(new RemoteGui::HSpacer));
129  }
130 
131  void
132  getValueFromMap(CartesianWaypointControllerConfig& cfg,
134  std::string const& name)
135  {
136  getValueFromMap(cfg.maxPositionAcceleration, values, name + "_maxAcc_Pos");
137  getValueFromMap(cfg.maxOrientationAcceleration, values, name + "_maxAcc_Ori");
138  getValueFromMap(cfg.maxNullspaceAcceleration, values, name + "_maxAcc_Null");
139 
140  getValueFromMap(cfg.kpJointLimitAvoidance, values, name + "_JointLimitAvoidance_KP");
141  getValueFromMap(cfg.jointLimitAvoidanceScale, values, name + "_JointLimitAvoidance_Scale");
142 
143  getValueFromMap(cfg.thresholdOrientationNear, values, name + "_Thresholds_Ori_Near");
144  getValueFromMap(cfg.thresholdOrientationReached, values, name + "_Thresholds_Ori_Reached");
145  getValueFromMap(cfg.thresholdPositionNear, values, name + "_Thresholds_Pos_Near");
146  getValueFromMap(cfg.thresholdPositionReached, values, name + "_Thresholds_Pos_Reached");
147 
148  getValueFromMap(cfg.maxOriVel, values, name + "_Max_vel_ori");
149  getValueFromMap(cfg.maxPosVel, values, name + "_Max_vel_pos");
150  getValueFromMap(cfg.kpOri, values, name + "_KP_ori");
151  getValueFromMap(cfg.kpPos, values, name + "_KP_pos");
152  }
153 } // namespace armarx::RemoteGui
armarx::RemoteGui::detail::MinMaxMixin::min
Derived & min(Type min)
Definition: Basic.h:88
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::detail::SimpleGridLayoutBuilder::addChild
SimpleGridLayoutBuilder & addChild(WidgetPtr const &child, int colspan)
Definition: LayoutWidgets.h:121
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
armarx::RemoteGui::makeSimpleGridLayout
detail::SimpleGridLayoutBuilder makeSimpleGridLayout(std::string const &name="")
Definition: LayoutWidgets.h:235
armarx::RemoteGui::detail::MinMaxMixin::max
Derived & max(Type max)
Definition: Basic.h:116
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::RemoteGui::detail::ChildrenMixin::addChild
Derived & addChild(WidgetPtr const &child)
Definition: LayoutWidgets.h:22
armarx::RemoteGui::detail::FloatSpinBoxBuilder::decimals
FloatSpinBoxBuilder & decimals(int decimals)
Definition: FloatWidgets.h:29
armarx::RemoteGui::detail::ValueMixin::value
Derived & value(ValueT const &value)
Definition: Basic.h:77
armarx::RemoteGui::makeGroupBox
detail::GroupBoxBuilder makeGroupBox(std::string const &name="")
Definition: LayoutWidgets.h:250
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
RemoteGui.h
armarx::RemoteGui::makeConfigGui
requires isAronGenerated< AronStructT > detail::GroupBoxBuilder makeConfigGui(const std::string &name, const AronStructT &val)
Definition: RemoteGui.h:41