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, const CartesianWaypointControllerConfig& val)
29 {
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))
41 .addChild(RemoteGui::makeTextLabel("Ori:"))
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:"))
58 .addChild(RemoteGui::makeTextLabel("KP:"))
59 .addChild(RemoteGui::makeFloatSpinBox(name + "_JointLimitAvoidance_KP")
60 .min(0)
61 .max(10)
62 .value(val.kpJointLimitAvoidance)
63 .decimals(3))
64 .addChild(RemoteGui::makeTextLabel("Scale:"))
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:"))
77 .addChild(RemoteGui::makeTextLabel("Near:"))
78 .addChild(RemoteGui::makeFloatSpinBox(name + "_Thresholds_Pos_Near")
79 .min(0)
80 .max(1000)
81 .value(val.thresholdPositionNear)
82 .decimals(3))
83 .addChild(RemoteGui::makeTextLabel("Reached:"))
84 .addChild(RemoteGui::makeFloatSpinBox(name + "_Thresholds_Pos_Reached")
85 .min(0)
86 .max(1000)
87 .value(val.thresholdPositionReached)
88 .decimals(3))
89 .addChild(RemoteGui::makeTextLabel("Max vel:"))
90 .addChild(RemoteGui::makeFloatSpinBox(name + "_Max_vel_pos")
91 .min(0)
92 .max(1000)
93 .value(val.maxPosVel)
94 .decimals(3))
95 .addChild(RemoteGui::makeTextLabel("KP:"))
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:"))
104 .addChild(RemoteGui::makeTextLabel("Near:"))
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))
122 .addChild(RemoteGui::makeTextLabel("KP:"))
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,
133 RemoteGui::ValueMap const& values,
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
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
detail::SimpleGridLayoutBuilder makeSimpleGridLayout(std::string const &name="")
detail::GroupBoxBuilder makeGroupBox(std::string const &name="")
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 & addChild(WidgetPtr const &child)