FTSensorCalibrationGuiWidgetController.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::gui-plugins::FTSensorCalibrationGuiWidgetController
17  * \author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * \date 2020
19  * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #include <string>
23 
24 #include <QRegExp>
25 
28 
30 
31 //boilerplate config
32 namespace armarx
33 {
35  {
37  std::lock_guard g{_all_mutex};
38  getRobotStateComponentPlugin().setRobotStateComponentName(settings->value("rsc", "Armar6StateComponent").toString().toStdString());
39  getRobotUnitComponentPlugin().setRobotUnitName(settings->value("ru", "Armar6Unit").toString().toStdString());
40  getDebugObserverComponentPlugin().setDebugObserverTopic(settings->value("dbgo", "DebugObserver").toString().toStdString());
41  }
42 
44  {
46  std::lock_guard g{_all_mutex};
47  settings->setValue("rsc", QString::fromStdString(getRobotStateComponentPlugin().getRobotStateComponentName()));
48  settings->setValue("ru", QString::fromStdString(getRobotUnitComponentPlugin().getRobotUnitName()));
49  settings->setValue("dbgo", QString::fromStdString(getDebugObserverComponentPlugin().getDebugObserverTopic()));
50  }
51 
53  {
55  std::lock_guard g{_all_mutex};
56  if (!_dialog)
57  {
58  _dialog = new SimpleConfigDialog(parent);
59  _dialog->addProxyFinder<RobotUnitInterfacePrx>("ru", "Robot Unit", "*Unit");
60  _dialog->addProxyFinder<RobotStateComponentInterfacePrx>("rsc", "Robot State Component", "*Component");
61  _dialog->addLineEdit("dbgo", "DebugObserver Topic", "DebugObserver");
62  }
63  return qobject_cast<SimpleConfigDialog*>(_dialog);
64  }
65 
67  {
69  std::lock_guard g{_all_mutex};
71  getRobotUnitComponentPlugin().setRobotUnitName(_dialog->get("ru"));
73  }
74 
75 }
76 namespace armarx
77 {
79  {
80  _widget.setupUi(getWidget());
81 
82  _widget.pushButtonLoadCalibFromFile->setVisible(false);
83  connect(_widget.pushButtonLoadCalibFromFile, &QPushButton::clicked,
84  this, &FTSensorCalibrationGuiWidgetController::loadCalibFromFile);
85  connect(_widget.pushButtonStart, &QPushButton::clicked,
86  this, &FTSensorCalibrationGuiWidgetController::startRecording);
87  connect(_widget.pushButtonStop, &QPushButton::clicked,
88  this, &FTSensorCalibrationGuiWidgetController::stopRecording);
89  connect(_widget.pushButtonLoadDefaultArmar6FTL, &QPushButton::clicked,
90  this, &FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTL);
91  connect(_widget.pushButtonLoadDefaultArmar6FTR, &QPushButton::clicked,
92  this, &FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTR);
93 
94  connect(_widget.tableWidgetOffset, &QTableWidget::itemChanged,
95  this, &FTSensorCalibrationGuiWidgetController::updateCalibration);
96  connect(_widget.tableWidgetOffset, &QTableWidget::itemChanged,
97  this, &FTSensorCalibrationGuiWidgetController::updateCalibration);
98  connect(_widget.tableWidgetChannelOrder, &QTableWidget::itemChanged,
99  this, &FTSensorCalibrationGuiWidgetController::updateCalibration);
100  connect(_widget.doubleSpinBoxTickToVolt, qOverload<double>(&QDoubleSpinBox::valueChanged),
101  this, &FTSensorCalibrationGuiWidgetController::updateCalibration);
102  connect(_widget.doubleSpinBoxTickToVoltE, qOverload<int>(&QSpinBox::valueChanged),
103  this, &FTSensorCalibrationGuiWidgetController::updateCalibration);
104 
105  connect(_widget.tableWidgetCompensate, &QTableWidget::itemChanged,
106  this, &FTSensorCalibrationGuiWidgetController::updateCompensation);
107 
108  loadDefaultArmar6FTR();
109  startTimer(10);
110  }
111 
112 
114  {}
115 
117  {
118  ARMARX_TRACE;
119  std::lock_guard g{_all_mutex};
120  _robot = addOrGetRobot("r", VirtualRobot::RobotIO::RobotDescription::eStructure);
121  }
122 
124  {
125  ARMARX_TRACE;
126  std::lock_guard g{_all_mutex};
127  stopRecording();
128  _comboboxes_are_set_up = false;
129  _robot = nullptr;
130  }
131 
133  {
134  ARMARX_TRACE;
135  std::lock_guard g{_all_mutex};
136  if (!_robot)
137  {
138  _widget.widgetFields->setEnabled(false);
139  return;
140  }
141  const auto to_list = [](const auto & container)
142  {
143  QStringList qnames;
144  for (const auto& name : container)
145  {
146  qnames << QString::fromStdString(name);
147  }
148  return qnames;
149  };
150  if (!_comboboxes_are_set_up)
151  {
152  {
153  const auto vec = getRobotUnit()->getLoggingNames();
154  _all_logging_names = std::set<std::string>(vec.begin(), vec.end());
155  }
156  const auto qnames = to_list(_all_logging_names);
157  const auto setup = [&](auto box, const auto & lst, auto regex)
158  {
159  box->clear();
160  box->addItems(lst);
161  const auto idx = lst.indexOf(QRegExp{regex});
162  if (idx >= 0)
163  {
164  box->setCurrentIndex(idx);
165  }
166  };
167  setup(_widget.comboBoxADC1Value, qnames, R"(^sens\.FT R\.adc_raw_1_to_3\.x$)");
168  setup(_widget.comboBoxADC2Value, qnames, R"(^sens\.FT R\.adc_raw_1_to_3\.y$)");
169  setup(_widget.comboBoxADC3Value, qnames, R"(^sens\.FT R\.adc_raw_1_to_3\.z$)");
170  setup(_widget.comboBoxADC4Value, qnames, R"(^sens\.FT R\.adc_raw_4_to_6\.x$)");
171  setup(_widget.comboBoxADC5Value, qnames, R"(^sens\.FT R\.adc_raw_4_to_6\.y$)");
172  setup(_widget.comboBoxADC6Value, qnames, R"(^sens\.FT R\.adc_raw_4_to_6\.z$)");
173 
174  setup(_widget.comboBoxADC1Temp, qnames, R"(^sens\.FT R\.adc_1_to_3_temperature$)");
175  setup(_widget.comboBoxADC2Temp, qnames, R"(^sens\.FT R\.adc_1_to_3_temperature$)");
176  setup(_widget.comboBoxADC3Temp, qnames, R"(^sens\.FT R\.adc_1_to_3_temperature$)");
177  setup(_widget.comboBoxADC4Temp, qnames, R"(^sens\.FT R\.adc_4_to_6_temperature$)");
178  setup(_widget.comboBoxADC5Temp, qnames, R"(^sens\.FT R\.adc_4_to_6_temperature$)");
179  setup(_widget.comboBoxADC6Temp, qnames, R"(^sens\.FT R\.adc_4_to_6_temperature$)");
180 
181  setup(_widget.comboBoxKinematicChain,
182  to_list(_robot->getRobotNodeSetNames()),
183  "^Robot$");
184 
185  _widget.pushButtonStart->setEnabled(true);
186  _widget.widgetFields->setEnabled(true);
187  _comboboxes_are_set_up = true;
188  return;
189  }
190 
191  _widget.comboBoxADC1Value->setEnabled(!_recording);
192  _widget.comboBoxADC2Value->setEnabled(!_recording);
193  _widget.comboBoxADC3Value->setEnabled(!_recording);
194  _widget.comboBoxADC4Value->setEnabled(!_recording);
195  _widget.comboBoxADC5Value->setEnabled(!_recording);
196  _widget.comboBoxADC6Value->setEnabled(!_recording);
197 
198  _widget.comboBoxADC1Temp ->setEnabled(!_recording);
199  _widget.comboBoxADC2Temp ->setEnabled(!_recording);
200  _widget.comboBoxADC3Temp ->setEnabled(!_recording);
201  _widget.comboBoxADC4Temp ->setEnabled(!_recording);
202  _widget.comboBoxADC5Temp ->setEnabled(!_recording);
203  _widget.comboBoxADC6Temp ->setEnabled(!_recording);
204 
205  if (!_recording)
206  {
207  return;
208  }
210  //do transform, plotting and logging
211  {
212  auto& data = _streaming_handler->getDataBuffer();
213  setDebugObserverDatafield("number_of_timesteps", data.size());
214  long time_compensation_us = 0;
215  if (!data.empty())
216  {
217  const auto log = [&](auto n)
218  {
219  _logfile << ';' << n;
220  };
221  for (const auto& s : data)
222  {
223  _logfile << s.iterationId << ';' << s.timestampUSec;
224  //logging
228  _logfile << '\n';
229  }
230  std::vector<float> vals;
231  {
232  const auto& last = data.back();
233  const auto pback = [&](auto n)
234  {
235  vals.emplace_back(n);
236  };
238  RobotUnitDataStreamingReceiver::VisitEntries(pback, last, _adc_temp);
239  }
240  //calc + compensate
241 
242  Eigen::Vector6f raw_ft_unordered;
243  raw_ft_unordered[0] = vals.at(0);
244  raw_ft_unordered[1] = vals.at(1);
245  raw_ft_unordered[2] = vals.at(2);
246  raw_ft_unordered[3] = vals.at(3);
247  raw_ft_unordered[4] = vals.at(4);
248  raw_ft_unordered[5] = vals.at(5);
249 
250  Eigen::Vector6f temp_unordered;
251  temp_unordered[0] = vals.at(6 + 0);
252  temp_unordered[1] = vals.at(6 + 1);
253  temp_unordered[2] = vals.at(6 + 2);
254  temp_unordered[3] = vals.at(6 + 3);
255  temp_unordered[4] = vals.at(6 + 4);
256  temp_unordered[5] = vals.at(6 + 5);
257 
258  _widget.labelADC1Value->setText(QString::number(raw_ft_unordered(0)));
259  _widget.labelADC2Value->setText(QString::number(raw_ft_unordered(1)));
260  _widget.labelADC3Value->setText(QString::number(raw_ft_unordered(2)));
261  _widget.labelADC4Value->setText(QString::number(raw_ft_unordered(3)));
262  _widget.labelADC5Value->setText(QString::number(raw_ft_unordered(4)));
263  _widget.labelADC6Value->setText(QString::number(raw_ft_unordered(5)));
264 
265  _widget.labelADC1Temp ->setText(QString::number(temp_unordered(0)));
266  _widget.labelADC2Temp ->setText(QString::number(temp_unordered(1)));
267  _widget.labelADC3Temp ->setText(QString::number(temp_unordered(2)));
268  _widget.labelADC4Temp ->setText(QString::number(temp_unordered(3)));
269  _widget.labelADC5Temp ->setText(QString::number(temp_unordered(4)));
270  _widget.labelADC6Temp ->setText(QString::number(temp_unordered(5)));
271 
272  const auto do_compensation = [&]
273  {
274  const auto st = std::chrono::high_resolution_clock::now();
275  for (int i = 0; i < 6; ++i)
276  {
277  raw_ft_unordered(i) =
278  _comp_table.compensate(temp_unordered(i), raw_ft_unordered(i));
279  }
280  const auto dt = std::chrono::high_resolution_clock::now() - st;
281  time_compensation_us = std::chrono::duration_cast<std::chrono::microseconds>(dt).count();
282  };
283 
284  if (_widget.radioButtonCompBeforeOffset->isChecked())
285  {
286  do_compensation();
287  }
288  raw_ft_unordered -= _offset;
289  if (_widget.radioButtonCompAfterOffset->isChecked())
290  {
291  do_compensation();
292  }
293  setDebugObserverDatafield("time_compensation_us", time_compensation_us);
294 
295  Eigen::Vector6f raw_ft;
296  raw_ft[0] = raw_ft_unordered(_channel_order(0));
297  raw_ft[1] = raw_ft_unordered(_channel_order(1));
298  raw_ft[2] = raw_ft_unordered(_channel_order(2));
299  raw_ft[3] = raw_ft_unordered(_channel_order(3));
300  raw_ft[4] = raw_ft_unordered(_channel_order(4));
301  raw_ft[5] = raw_ft_unordered(_channel_order(5));
302 
303  const Eigen::Vector6f ft = _conversion_matrix * (raw_ft * _ticks_to_volt_factor);
304 
305  //write to debug observer
306  setDebugObserverDatafield("fx", ft(0));
307  setDebugObserverDatafield("fy", ft(1));
308  setDebugObserverDatafield("fz", ft(2));
309  setDebugObserverDatafield("tx", ft(3));
310  setDebugObserverDatafield("ty", ft(4));
311  setDebugObserverDatafield("tz", ft(5));
312  }
313 
314  data.clear();
315  }
317  }
318 
319  void FTSensorCalibrationGuiWidgetController::startRecording()
320  {
321  ARMARX_TRACE;
322  std::lock_guard g{_all_mutex};
323  _widget.pushButtonStart->setEnabled(false);
324  _widget.pushButtonStop->setEnabled(true);
325 
326  const std::array field_adc_value =
327  {
328  _widget.comboBoxADC1Value->currentText().toStdString(),
329  _widget.comboBoxADC2Value->currentText().toStdString(),
330  _widget.comboBoxADC3Value->currentText().toStdString(),
331  _widget.comboBoxADC4Value->currentText().toStdString(),
332  _widget.comboBoxADC5Value->currentText().toStdString(),
333  _widget.comboBoxADC6Value->currentText().toStdString()
334  };
335 
336  const std::array field_adc_temp =
337  {
338  _widget.comboBoxADC1Temp ->currentText().toStdString(),
339  _widget.comboBoxADC2Temp ->currentText().toStdString(),
340  _widget.comboBoxADC3Temp ->currentText().toStdString(),
341  _widget.comboBoxADC4Temp ->currentText().toStdString(),
342  _widget.comboBoxADC5Temp ->currentText().toStdString(),
343  _widget.comboBoxADC6Temp ->currentText().toStdString()
344  };
345 
346 
347  //setup streaming
348  {
349  RobotUnitDataStreaming::Config cfg;
350 
351  std::set<std::string> to_log;
352 
353  to_log.emplace(field_adc_value.at(0));
354  to_log.emplace(field_adc_value.at(1));
355  to_log.emplace(field_adc_value.at(2));
356  to_log.emplace(field_adc_value.at(3));
357  to_log.emplace(field_adc_value.at(4));
358  to_log.emplace(field_adc_value.at(5));
359 
360  to_log.emplace(field_adc_temp.at(0));
361  to_log.emplace(field_adc_temp.at(1));
362  to_log.emplace(field_adc_temp.at(2));
363  to_log.emplace(field_adc_temp.at(3));
364  to_log.emplace(field_adc_temp.at(4));
365  to_log.emplace(field_adc_temp.at(5));
366 
367 
368  ///TODO
369  //filter by rns
370  const auto rns_name = _widget.comboBoxKinematicChain ->currentText().toStdString();
371  ARMARX_CHECK_EXPRESSION(_robot->hasRobotNodeSet(rns_name)) << VAROUT(rns_name);
372  for (const auto& name : _robot->getRobotNodeSet(rns_name)->getNodeNames())
373  {
374  auto dataf = "sens." + name + ".position";
375  if (_all_logging_names.count(dataf))
376  {
377  to_log.emplace(std::move(dataf));
378  }
379  }
380  cfg.loggingNames.insert(cfg.loggingNames.end(), to_log.begin(), to_log.end());
381  _streaming_handler =
382  make_shared<RobotUnitDataStreamingReceiver>(this, getRobotUnit(), cfg);
383  }
384  //setup csv log + indices
385  {
386  auto entries = _streaming_handler->getDataDescription().entries;
387  for (std::size_t i = 0; i < 6; ++i)
388  {
389  ARMARX_CHECK_EXPRESSION(entries.count(field_adc_value.at(i))) << VAROUT(field_adc_value.at(i));
390  ARMARX_CHECK_EXPRESSION(entries.count(field_adc_temp.at(i))) << VAROUT(field_adc_temp.at(i));
391  _adc.at(i) = entries.at(field_adc_value.at(i));
392  _adc_temp.at(i) = entries.at(field_adc_temp.at(i));
393  }
394  for (std::size_t i = 0; i < 6; ++i)
395  {
396  entries.erase(field_adc_value.at(i));
397  entries.erase(field_adc_temp.at(i));
398  }
399 
400  const std::filesystem::path path = FileSystemPathBuilder::ApplyFormattingAndResolveEnvAndCMakeVars(_widget.lineEditLogFile->text().toStdString());
401  if (path.has_parent_path())
402  {
403  std::filesystem::create_directories(path.parent_path());
404  }
405  ARMARX_INFO << "Logging to " << path;
406  _logfile.open(path.string());
407  _logfile << "iteration;timestamp;adc1;adc2;adc3;adc4;adc5;acd1_temp;acd2_temp;acd3_temp;acd4_temp;acd5_temp";
408 
409  for (const auto& [name, entry] : entries)
410  {
411  _joints.emplace_back(entry);
412  _logfile << ';' << name;
413  }
414  _logfile << std::endl;
415  }
416 
417  _recording = true;
418  }
419  void FTSensorCalibrationGuiWidgetController::stopRecording()
420  {
421  ARMARX_TRACE;
422  std::lock_guard g{_all_mutex};
423  _widget.pushButtonStart->setEnabled(true);
424  _widget.pushButtonStop->setEnabled(false);
425  _recording = false;
426  _streaming_handler = nullptr;
427  _logfile = std::ofstream{};
428  }
429 
430  template<class T>
431  T str_to_val(const auto& str)
432  {
433 #define option(type, fn) if constexpr(std::is_same_v<T, type>) { return str.fn() ; } else
434  option(double, toDouble)
435  option(float, toFloat)
436  option(int, toInt)
437  option(long, toLong)
438  option(qlonglong, toLongLong)
439  option(short, toShort)
440  option(uint, toUInt)
441  option(ulong, toULong)
442  option(qulonglong, toULongLong)
443  option(ushort, toUShort)
444  {
445  static_assert(!std::is_same_v<float_t, float_t>, "this function can't handle the given type");
446  }
447 #undef option
448  }
449 
450  template<class T>
451  void str_to_val(const auto& str, T& val)
452  {
453  val = str_to_val<T>(str);
454  }
455 
456  template<class T>
458  {
459  return str.isEmpty() ? opt : str_to_val<T>(str);;
460  }
461 
462  void read(auto& eigen, auto* table)
463  {
464  for (int c = 0; c < eigen.cols(); ++c)
465  {
466  for (int r = 0; r < eigen.rows(); ++r)
467  {
468  auto it = table->item(r, c);
470  QString str = it->text();
471  if (str.isEmpty())
472  {
473  str = "0";
474  }
475  str_to_val(it->text(), eigen(r, c));
476  }
477  }
478  }
479 
480  void FTSensorCalibrationGuiWidgetController::updateCalibration()
481  {
482  ARMARX_TRACE;
483  //read all tables:
484  read(_conversion_matrix, _widget.tableWidgetMatrix);
485  read(_offset, _widget.tableWidgetOffset);
486  read(_channel_order, _widget.tableWidgetChannelOrder);
487  _ticks_to_volt_factor = _widget.doubleSpinBoxTickToVolt->value() *
488  std::pow(10.0, 1.0 * _widget.doubleSpinBoxTickToVoltE->value());
489  }
490 
491  void FTSensorCalibrationGuiWidgetController::updateCompensation()
492  {
493  ARMARX_TRACE;
494  _comp_table.table.clear();
495  const auto maxRows = _widget.tableWidgetCompensate->rowCount();
496  //read all tables:
497  for (int r = 0; r < maxRows; ++r)
498  {
499  const auto read_cell = [&](int col)
500  {
501  auto it = _widget.tableWidgetCompensate->item(r, col);
503  return it->text();
504  };
505  const auto c0 = read_cell(0);
506  if (c0.isEmpty())
507  {
508  continue;
509  }
510 
511  _comp_table.table.emplace_back(std::array
512  {
513  str_to_val<float>(c0),
514  str_to_val_with_opt_on_empty<float>(read_cell(1), 0),
515  str_to_val_with_opt_on_empty<float>(read_cell(2), 0)
516  });
517  std::sort(_comp_table.table.begin(), _comp_table.table.end());
518  }
519  }
520 
521  void FTSensorCalibrationGuiWidgetController::loadCalibFromFile()
522  {
523  ARMARX_TRACE;
524 
525  }
526 
527  void FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTR()
528  {
529  ARMARX_TRACE;
530  const auto set = [&](auto tab, auto row, auto col, auto str)
531  {
532  auto it = tab->item(row, col);
533  ARMARX_CHECK_NOT_NULL(it) << VAROUT(tab->objectName()) << '\n'
534  << VAROUT(row) << " / " << VAROUT(col);
535  it->setText(str);
536  };
537  set(_widget.tableWidgetMatrix, 0, 0, "-467.643251792");
538  set(_widget.tableWidgetMatrix, 0, 1, "91.3750529228");
539  set(_widget.tableWidgetMatrix, 0, 2, "2494.4447796887");
540  set(_widget.tableWidgetMatrix, 0, 3, "-21630.9316531438");
541  set(_widget.tableWidgetMatrix, 0, 4, "-2015.8633957692");
542  set(_widget.tableWidgetMatrix, 0, 5, "21220.5317464812");
543 
544  set(_widget.tableWidgetMatrix, 1, 0, "-632.4535042867");
545  set(_widget.tableWidgetMatrix, 1, 1, "26666.445463403");
546  set(_widget.tableWidgetMatrix, 1, 2, "888.174687977");
547  set(_widget.tableWidgetMatrix, 1, 3, "-12567.7138845759");
548  set(_widget.tableWidgetMatrix, 1, 4, "2056.9631948303");
549  set(_widget.tableWidgetMatrix, 1, 5, "-12362.9602817359");
550 
551  set(_widget.tableWidgetMatrix, 2, 0, "32117.1345018829");
552  set(_widget.tableWidgetMatrix, 2, 1, "1042.3739547082");
553  set(_widget.tableWidgetMatrix, 2, 2, "32619.3235489089");
554  set(_widget.tableWidgetMatrix, 2, 3, "401.9862056573");
555  set(_widget.tableWidgetMatrix, 2, 4, "32571.279999299");
556  set(_widget.tableWidgetMatrix, 2, 5, "1238.1723510684");
557 
558  set(_widget.tableWidgetMatrix, 3, 0, "-7.9924072503");
559  set(_widget.tableWidgetMatrix, 3, 1, "183.6989072793");
560  set(_widget.tableWidgetMatrix, 3, 2, "-528.3700035934");
561  set(_widget.tableWidgetMatrix, 3, 3, "-95.0326724598");
562  set(_widget.tableWidgetMatrix, 3, 4, "529.7112223958");
563  set(_widget.tableWidgetMatrix, 3, 5, "-67.4388404574");
564 
565  set(_widget.tableWidgetMatrix, 4, 0, "601.7174062086");
566  set(_widget.tableWidgetMatrix, 4, 1, "19.2614267838");
567  set(_widget.tableWidgetMatrix, 4, 2, "-343.4582260308");
568  set(_widget.tableWidgetMatrix, 4, 3, "144.3830278106");
569  set(_widget.tableWidgetMatrix, 4, 4, "-284.5086278763");
570  set(_widget.tableWidgetMatrix, 4, 5, "-156.6756177634");
571 
572  set(_widget.tableWidgetMatrix, 5, 0, "6.7801800162");
573  set(_widget.tableWidgetMatrix, 5, 1, "-339.2302595085");
574  set(_widget.tableWidgetMatrix, 5, 2, "35.4255085497");
575  set(_widget.tableWidgetMatrix, 5, 3, "-320.187165265");
576  set(_widget.tableWidgetMatrix, 5, 4, "40.6862246688");
577  set(_widget.tableWidgetMatrix, 5, 5, "-314.5800995414");
578 
579  set(_widget.tableWidgetOffset, 0, 0, "0");
580  set(_widget.tableWidgetOffset, 1, 0, "0");
581  set(_widget.tableWidgetOffset, 2, 0, "0");
582  set(_widget.tableWidgetOffset, 3, 0, "0");
583  set(_widget.tableWidgetOffset, 4, 0, "0");
584  set(_widget.tableWidgetOffset, 5, 0, "0");
585 
586  set(_widget.tableWidgetChannelOrder, 0, 0, "0");
587  set(_widget.tableWidgetChannelOrder, 1, 0, "1");
588  set(_widget.tableWidgetChannelOrder, 2, 0, "2");
589  set(_widget.tableWidgetChannelOrder, 3, 0, "3");
590  set(_widget.tableWidgetChannelOrder, 4, 0, "4");
591  set(_widget.tableWidgetChannelOrder, 5, 0, "5");
592 
593  _widget.doubleSpinBoxTickToVolt->setValue(-7.275957614183426);
594  _widget.doubleSpinBoxTickToVoltE->setValue(-12);
595  }
596 
597  void FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTL()
598  {
599  ARMARX_TRACE;
600  const auto set = [&](auto tab, auto row, auto col, auto str)
601  {
602  auto it = tab->item(row, col);
603  ARMARX_CHECK_NOT_NULL(it) << VAROUT(tab->objectName()) << '\n'
604  << VAROUT(row) << " / " << VAROUT(col);
605  it->setText(str);
606  };
607  set(_widget.tableWidgetMatrix, 0, 0, "243.0341527991");
608  set(_widget.tableWidgetMatrix, 0, 1, "101.5053757216");
609  set(_widget.tableWidgetMatrix, 0, 2, "3363.1141700153");
610  set(_widget.tableWidgetMatrix, 0, 3, "-22042.8003987865");
611  set(_widget.tableWidgetMatrix, 0, 4, "-1473.1343892481");
612  set(_widget.tableWidgetMatrix, 0, 5, "22371.6116908654");
613 
614  set(_widget.tableWidgetMatrix, 1, 0, "-2855.7194248476");
615  set(_widget.tableWidgetMatrix, 1, 1, "26276.7522410658");
616  set(_widget.tableWidgetMatrix, 1, 2, "1998.8250953037");
617  set(_widget.tableWidgetMatrix, 1, 3, "-12713.8569146837");
618  set(_widget.tableWidgetMatrix, 1, 4, "298.7344647758");
619  set(_widget.tableWidgetMatrix, 1, 5, "-12925.3451059361");
620 
621  set(_widget.tableWidgetMatrix, 2, 0, "32124.3594508476");
622  set(_widget.tableWidgetMatrix, 2, 1, "1084.8849712208");
623  set(_widget.tableWidgetMatrix, 2, 2, "32074.9427983169");
624  set(_widget.tableWidgetMatrix, 2, 3, "1590.5268672115");
625  set(_widget.tableWidgetMatrix, 2, 4, "31332.9720074452");
626  set(_widget.tableWidgetMatrix, 2, 5, "1975.0541066964");
627 
628  set(_widget.tableWidgetMatrix, 3, 0, "-16.374713716");
629  set(_widget.tableWidgetMatrix, 3, 1, "180.8318075047");
630  set(_widget.tableWidgetMatrix, 3, 2, "-507.7906728024");
631  set(_widget.tableWidgetMatrix, 3, 3, "-111.2589978068");
632  set(_widget.tableWidgetMatrix, 3, 4, "503.7542430159");
633  set(_widget.tableWidgetMatrix, 3, 5, "-59.7462546316");
634 
635  set(_widget.tableWidgetMatrix, 4, 0, "598.6997045889");
636  set(_widget.tableWidgetMatrix, 4, 1, "15.4552761047");
637  set(_widget.tableWidgetMatrix, 4, 2, "-323.6960410703");
638  set(_widget.tableWidgetMatrix, 4, 3, "137.7987236203");
639  set(_widget.tableWidgetMatrix, 4, 4, "-296.3155623038");
640  set(_widget.tableWidgetMatrix, 4, 5, "-171.7206902305");
641 
642  set(_widget.tableWidgetMatrix, 5, 0, "49.6982738536");
643  set(_widget.tableWidgetMatrix, 5, 1, "-335.3035629766");
644  set(_widget.tableWidgetMatrix, 5, 2, "43.0493257519");
645  set(_widget.tableWidgetMatrix, 5, 3, "-323.8948308006");
646  set(_widget.tableWidgetMatrix, 5, 4, "15.3044378249");
647  set(_widget.tableWidgetMatrix, 5, 5, "-329.7565028853");
648 
649  set(_widget.tableWidgetOffset, 0, 0, "0");
650  set(_widget.tableWidgetOffset, 1, 0, "0");
651  set(_widget.tableWidgetOffset, 2, 0, "0");
652  set(_widget.tableWidgetOffset, 3, 0, "0");
653  set(_widget.tableWidgetOffset, 4, 0, "0");
654  set(_widget.tableWidgetOffset, 5, 0, "0");
655 
656  set(_widget.tableWidgetChannelOrder, 0, 0, "0");
657  set(_widget.tableWidgetChannelOrder, 1, 0, "1");
658  set(_widget.tableWidgetChannelOrder, 2, 0, "2");
659  set(_widget.tableWidgetChannelOrder, 3, 0, "3");
660  set(_widget.tableWidgetChannelOrder, 4, 0, "4");
661  set(_widget.tableWidgetChannelOrder, 5, 0, "5");
662 
663  _widget.doubleSpinBoxTickToVolt->setValue(-7.275957614183426);
664  _widget.doubleSpinBoxTickToVoltE->setValue(-12);
665  }
666 }
armarx::toUInt
unsigned int toUInt(const std::string &input)
Definition: StringHelpers.cpp:118
str
std::string str(const T &t)
Definition: UserAssistedSegmenterGuiWidgetController.cpp:42
armarx::plugins::RobotUnitComponentPlugin::setRobotUnitName
void setRobotUnitName(const std::string &name)
Definition: RobotUnitComponentPlugin.cpp:118
armarx::toInt
int toInt(const std::string &input)
Definition: StringHelpers.cpp:108
armarx::FTSensorCalibrationGuiWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: FTSensorCalibrationGuiWidgetController.cpp:52
FTSensorCalibrationGuiWidgetController.h
armarx::DebugObserverComponentPluginUser::getDebugObserverComponentPlugin
plugins::DebugObserverComponentPlugin & getDebugObserverComponentPlugin()
Definition: DebugObserverComponentPlugin.cpp:85
armarx::DebugObserverComponentPluginUser::setDebugObserverBatchModeEnabled
void setDebugObserverBatchModeEnabled(bool enable)
Definition: DebugObserverComponentPlugin.cpp:118
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::plugins::DebugObserverComponentPlugin::setDebugObserverTopic
void setDebugObserverTopic(const std::string &name)
Definition: DebugObserverComponentPlugin.cpp:30
armarx::toFloat
float toFloat(const std::string &input)
Converts a string to float and uses always dot as seperator.
Definition: StringHelpers.cpp:97
trace.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::plugins::RobotStateComponentPlugin::setRobotStateComponentName
void setRobotStateComponentName(const std::string &name)
Definition: RobotStateComponentPlugin.cpp:272
armarx::compensation_table::compensate
value_t compensate(value_t decision, value_t value) const
Definition: FTSensorCalibrationGuiWidgetController.h:60
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
armarx::FTSensorCalibrationGuiWidgetController::~FTSensorCalibrationGuiWidgetController
virtual ~FTSensorCalibrationGuiWidgetController()
Definition: FTSensorCalibrationGuiWidgetController.cpp:113
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::RobotStateComponentPluginUser::getRobotStateComponentPlugin
const RobotStateComponentPlugin & getRobotStateComponentPlugin() const
Definition: RobotStateComponentPlugin.cpp:307
armarx::str_to_val
T str_to_val(const auto &str)
Definition: FTSensorCalibrationGuiWidgetController.cpp:431
armarx::read
void read(auto &eigen, auto *table)
Definition: FTSensorCalibrationGuiWidgetController.cpp:462
armarx::FTSensorCalibrationGuiWidgetController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: FTSensorCalibrationGuiWidgetController.cpp:123
armarx::RobotUnitDataStreamingReceiver::VisitEntries
static void VisitEntries(auto &&f, const timestep_t &st, const auto &cont)
Definition: RobotUnitDataStreamingReceiver.h:272
armarx::FTSensorCalibrationGuiWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: FTSensorCalibrationGuiWidgetController.cpp:66
armarx::FTSensorCalibrationGuiWidgetController::FTSensorCalibrationGuiWidgetController
FTSensorCalibrationGuiWidgetController()
Definition: FTSensorCalibrationGuiWidgetController.cpp:78
armarx::compensation_table::table
std::vector< entry_t > table
Definition: FTSensorCalibrationGuiWidgetController.h:47
option
#define option(type, fn)
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::RobotStateComponentPluginUser::addOrGetRobot
VirtualRobot::RobotPtr addOrGetRobot(const std::string &id, Ts &&...ts)
Definition: RobotStateComponentPlugin.h:210
armarx::FTSensorCalibrationGuiWidgetController::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: FTSensorCalibrationGuiWidgetController.cpp:116
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:182
set
set(LIBS ArmarXCoreInterfaces ${CMAKE_THREAD_LIBS_INIT} ${dl_LIBRARIES} ${rt_LIBRARIES} ${QT_LIBRARIES} ${Boost_LIBRARIES} BoostAssertionHandler ArmarXCPPUtility SimoxUtility) set(LIB_FILES ArmarXManager.cpp ArmarXMultipleObjectsScheduler.cpp ArmarXObjectScheduler.cpp ManagedIceObject.cpp ManagedIceObjectPlugin.cpp Component.cpp ComponentPlugin.cpp IceGridAdmin.cpp ArmarXObjectObserver.cpp IceManager.cpp PackagePath.cpp RemoteReferenceCount.cpp logging/LoggingUtil.cpp logging/Logging.cpp logging/LogSender.cpp logging/ArmarXLogBuf.cpp system/ArmarXDataPath.cpp system/DynamicLibrary.cpp system/ProcessWatcher.cpp system/FactoryCollectionBase.cpp system/cmake/CMakePackageFinder.cpp system/cmake/CMakePackageFinderCache.cpp system/cmake/ArmarXPackageToolInterface.cpp system/RemoteObjectNode.cpp services/sharedmemory/HardwareId.cpp services/tasks/RunningTask.cpp services/tasks/ThreadList.cpp services/tasks/ThreadPool.cpp services/profiler/Profiler.cpp services/profiler/FileLoggingStrategy.cpp services/profiler/IceLoggingStrategy.cpp application/Application.cpp application/ApplicationOptions.cpp application/ApplicationProcessFacet.cpp application/ApplicationNetworkStats.cpp application/properties/PropertyUser.cpp application/properties/Property.cpp application/properties/PropertyDefinition.cpp application/properties/PropertyDefinitionContainer.cpp application/properties/PropertyDefinitionHelpFormatter.cpp application/properties/PropertyDefinitionConfigFormatter.cpp application/properties/PropertyDefinitionBriefHelpFormatter.cpp application/properties/PropertyDefinitionXmlFormatter.cpp application/properties/PropertyDefinitionDoxygenFormatter.cpp application/properties/PropertyDefinitionDoxygenComponentPagesFormatter.cpp application/properties/PropertyDefinitionContainerBriefHelpFormatter.cpp application/properties/IceProperties.cpp exceptions/Exception.cpp exceptions/local/UnexpectedEnumValueException.cpp util/FileSystemPathBuilder.cpp util/StringHelpers.cpp util/IceReportSkipper.cpp util/Throttler.cpp util/distributed/AMDCallbackCollection.cpp util/distributed/RemoteHandle/ClientSideRemoteHandleControlBlock.cpp util/distributed/RemoteHandle/RemoteHandle.cpp util/distributed/RemoteHandle/RemoteHandleControlBlock.cpp time/ice_conversions.cpp time/json_conversions.cpp time/CallbackWaitLock.cpp time/Clock.cpp time/ClockType.cpp time/ClockTypeNames.cpp time/CycleUtil.cpp time/DateTime.cpp time/Duration.cpp time/Frequency.cpp time/LocalTimeServer.cpp time/Metronome.cpp time/ScopedStopWatch.cpp time/StopWatch.cpp time/Timer.cpp time/TimeKeeper.cpp time/TimeUtil.cpp csv/CsvWriter.cpp csv/CsvReader.cpp eigen/conversions.cpp eigen/ice_conversions.cpp) set(LIB_HEADERS ArmarXManager.h ArmarXDummyManager.h ArmarXMultipleObjectsScheduler.h ArmarXObjectObserver.h ArmarXObjectScheduler.h ArmarXFwd.h Component.h ComponentPlugin.h ComponentFactories.h CoreObjectFactories.h IceGridAdmin.h IceManager.h IceManagerImpl.h json_conversions.h ManagedIceObject.h ManagedIceObjectPlugin.h ManagedIceObjectImpl.h ManagedIceObjectDependency.h ManagedIceObjectRegistryInterface.h PackagePath.h RemoteReferenceCount.h system/ImportExport.h system/ImportExportComponent.h system/AbstractFactoryMethod.h system/FactoryCollectionBase.h system/Synchronization.h system/ArmarXDataPath.h system/DynamicLibrary.h system/ProcessWatcher.h system/ConditionSynchronization.h system/cmake/CMakePackageFinder.h system/cmake/CMakePackageFinderCache.h system/cmake/FindPackageX.cmake system/cmake/ArmarXPackageToolInterface.h system/RemoteObjectNode.h logging/LoggingUtil.h logging/LogSender.h logging/Logging.h logging/ArmarXLogBuf.h logging/SpamFilterData.h services/tasks/RunningTask.h services/tasks/PeriodicTask.h services/tasks/ThreadList.h services/tasks/TaskUtil.h services/tasks/ThreadPool.h services/sharedmemory/SharedMemoryProvider.h services/sharedmemory/SharedMemoryConsumer.h services/sharedmemory/IceSharedMemoryProvider.h services/sharedmemory/IceSharedMemoryConsumer.h services/sharedmemory/HardwareIdentifierProvider.h services/sharedmemory/HardwareId.h services/sharedmemory/exceptions/SharedMemoryExceptions.h services/profiler/Profiler.h services/profiler/LoggingStrategy.h services/profiler/FileLoggingStrategy.h services/profiler/IceLoggingStrategy.h application/Application.h application/ApplicationOptions.h application/ApplicationProcessFacet.h application/ApplicationNetworkStats.h application/properties/forward_declarations.h application/properties/Properties.h application/properties/Property.h application/properties/PluginEigen.h application/properties/PluginEnumNames.h application/properties/PluginCfgStruct.h application/properties/PluginAll.h application/properties/PropertyUser.h application/properties/PropertyDefinition.h application/properties/PropertyDefinition.hpp application/properties/PropertyDefinitionInterface.h application/properties/PropertyDefinitionContainer.h application/properties/PropertyDefinitionFormatter.h application/properties/PropertyDefinitionContainerFormatter.h application/properties/PropertyDefinitionConfigFormatter.h application/properties/PropertyDefinitionHelpFormatter.h application/properties/PropertyDefinitionBriefHelpFormatter.h application/properties/PropertyDefinitionXmlFormatter.h application/properties/PropertyDefinitionDoxygenFormatter.h application/properties/PropertyDefinitionDoxygenComponentPagesFormatter.h application/properties/PropertyDefinitionContainerBriefHelpFormatter.h application/properties/ProxyPropertyDefinition.h application/properties/IceProperties.h exceptions/Exception.h exceptions/LocalException.h exceptions/local/DynamicLibraryException.h exceptions/local/ExpressionException.h exceptions/local/FileIOException.h exceptions/local/InvalidPropertyValueException.h exceptions/local/MissingRequiredPropertyException.h exceptions/local/PropertyInheritanceCycleException.h exceptions/local/ProxyNotInitializedException.h exceptions/local/UnexpectedEnumValueException.h exceptions/local/UnmappedValueException.h exceptions/local/ValueRangeExceededException.h exceptions/user/NotImplementedYetException.h rapidxml/rapidxml.hpp rapidxml/rapidxml_print.hpp rapidxml/rapidxml_iterators.hpp rapidxml/rapidxml_utils.hpp rapidxml/wrapper/RapidXmlReader.h rapidxml/wrapper/RapidXmlWriter.h rapidxml/wrapper/DefaultRapidXmlReader.h rapidxml/wrapper/MultiNodeRapidXMLReader.h util/IceBlobToObject.h util/ObjectToIceBlob.h util/FileSystemPathBuilder.h util/FiniteStateMachine.h util/StringHelpers.h util/StringHelperTemplates.h util/algorithm.h util/OnScopeExit.h util/Predicates.h util/Preprocessor.h util/PropagateConst.h util/Registrar.h util/TemplateMetaProgramming.h util/TripleBuffer.h util/IceReportSkipper.h util/Throttler.h util/distributed/AMDCallbackCollection.h util/distributed/RemoteHandle/ClientSideRemoteHandleControlBlock.h util/distributed/RemoteHandle/RemoteHandle.h util/distributed/RemoteHandle/RemoteHandleControlBlock.h util/SimpleStatemachine.h time.h time_minimal.h time/forward_declarations.h time/ice_conversions.h time/json_conversions.h time/CallbackWaitLock.h time/Clock.h time/ClockType.h time/ClockTypeNames.h time/CycleUtil.h time/DateTime.h time/Duration.h time/Frequency.h time/LocalTimeServer.h time/Metronome.h time/ScopedStopWatch.h time/StopWatch.h time/Timer.h time/TimeUtil.h time/TimeKeeper.h csv/CsvWriter.h csv/CsvReader.h eigen/conversions.h eigen/ice_conversions.h ice_conversions.h ice_conversions/ice_conversions_boost_templates.h ice_conversions/ice_conversions_templates.h ice_conversions/ice_conversions_templates.tpp $
Definition: CMakeLists.txt:12
armarx::DebugObserverComponentPluginUser::sendDebugObserverBatch
void sendDebugObserverBatch()
Definition: DebugObserverComponentPlugin.cpp:122
IceInternal::ProxyHandle<::IceProxy::armarx::RobotUnitInterface >
armarx::RobotUnitComponentPluginUser::getRobotUnitComponentPlugin
plugins::RobotUnitComponentPlugin & getRobotUnitComponentPlugin()
Definition: RobotUnitComponentPlugin.cpp:191
armarx::ArmarXWidgetController::getWidget
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
Definition: ArmarXWidgetController.cpp:54
Eigen::Matrix< float, 6, 1 >
armarx::FTSensorCalibrationGuiWidgetController::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: FTSensorCalibrationGuiWidgetController.cpp:34
T
float T
Definition: UnscentedKalmanFilterTest.cpp:35
armarx::FTSensorCalibrationGuiWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: FTSensorCalibrationGuiWidgetController.cpp:43
armarx::RobotUnitComponentPluginUser::getRobotUnit
RobotUnitInterfacePrx getRobotUnit() const
Definition: RobotUnitComponentPlugin.cpp:185
armarx::str_to_val_with_opt_on_empty
T str_to_val_with_opt_on_empty(const auto &str, T opt)
Definition: FTSensorCalibrationGuiWidgetController.cpp:457
armarx::FTSensorCalibrationGuiWidgetController::timerEvent
void timerEvent(QTimerEvent *event) override
Definition: FTSensorCalibrationGuiWidgetController.cpp:132
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
FileSystemPathBuilder.h
armarx::FileSystemPathBuilder::ApplyFormattingAndResolveEnvAndCMakeVars
static std::string ApplyFormattingAndResolveEnvAndCMakeVars(const std::string &rawPath)
Definition: FileSystemPathBuilder.cpp:94
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:42
armarx::DebugObserverComponentPluginUser::setDebugObserverDatafield
void setDebugObserverDatafield(Ts &&...ts) const
Definition: DebugObserverComponentPlugin.h:97
armarx::SimpleConfigDialog
A config-dialog containing one (or multiple) proxy finders.
Definition: SimpleConfigDialog.h:84