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  */
23 
24 #include <string>
25 
26 #include <QRegExp>
27 
28 #include <VirtualRobot/RobotNodeSet.h>
29 
32 
33 //boilerplate config
34 namespace armarx
35 {
36  void
38  {
40  std::lock_guard g{_all_mutex};
42  settings->value("rsc", "Armar6StateComponent").toString().toStdString());
44  settings->value("ru", "Armar6Unit").toString().toStdString());
46  settings->value("dbgo", "DebugObserver").toString().toStdString());
47  }
48 
49  void
51  {
53  std::lock_guard g{_all_mutex};
54  settings->setValue(
55  "rsc",
56  QString::fromStdString(getRobotStateComponentPlugin().getRobotStateComponentName()));
57  settings->setValue(
58  "ru", QString::fromStdString(getRobotUnitComponentPlugin().getRobotUnitName()));
59  settings->setValue(
60  "dbgo",
61  QString::fromStdString(getDebugObserverComponentPlugin().getDebugObserverTopic()));
62  }
63 
64  QPointer<QDialog>
66  {
68  std::lock_guard g{_all_mutex};
69  if (!_dialog)
70  {
71  _dialog = new SimpleConfigDialog(parent);
72  _dialog->addProxyFinder<RobotUnitInterfacePrx>("ru", "Robot Unit", "*Unit");
73  _dialog->addProxyFinder<RobotStateComponentInterfacePrx>(
74  "rsc", "Robot State Component", "*Component");
75  _dialog->addLineEdit("dbgo", "DebugObserver Topic", "DebugObserver");
76  }
77  return qobject_cast<SimpleConfigDialog*>(_dialog);
78  }
79 
80  void
82  {
84  std::lock_guard g{_all_mutex};
86  getRobotUnitComponentPlugin().setRobotUnitName(_dialog->get("ru"));
88  }
89 
90 } // namespace armarx
91 
92 namespace armarx
93 {
95  {
96  _widget.setupUi(getWidget());
97 
98  _widget.pushButtonLoadCalibFromFile->setVisible(false);
99  connect(_widget.pushButtonLoadCalibFromFile,
100  &QPushButton::clicked,
101  this,
102  &FTSensorCalibrationGuiWidgetController::loadCalibFromFile);
103  connect(_widget.pushButtonStart,
104  &QPushButton::clicked,
105  this,
106  &FTSensorCalibrationGuiWidgetController::startRecording);
107  connect(_widget.pushButtonStop,
108  &QPushButton::clicked,
109  this,
110  &FTSensorCalibrationGuiWidgetController::stopRecording);
111  connect(_widget.pushButtonLoadDefaultArmar6FTL,
112  &QPushButton::clicked,
113  this,
114  &FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTL);
115  connect(_widget.pushButtonLoadDefaultArmar6FTR,
116  &QPushButton::clicked,
117  this,
118  &FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTR);
119 
120  connect(_widget.tableWidgetOffset,
121  &QTableWidget::itemChanged,
122  this,
123  &FTSensorCalibrationGuiWidgetController::updateCalibration);
124  connect(_widget.tableWidgetOffset,
125  &QTableWidget::itemChanged,
126  this,
127  &FTSensorCalibrationGuiWidgetController::updateCalibration);
128  connect(_widget.tableWidgetChannelOrder,
129  &QTableWidget::itemChanged,
130  this,
131  &FTSensorCalibrationGuiWidgetController::updateCalibration);
132  connect(_widget.doubleSpinBoxTickToVolt,
133  qOverload<double>(&QDoubleSpinBox::valueChanged),
134  this,
135  &FTSensorCalibrationGuiWidgetController::updateCalibration);
136  connect(_widget.doubleSpinBoxTickToVoltE,
137  qOverload<int>(&QSpinBox::valueChanged),
138  this,
139  &FTSensorCalibrationGuiWidgetController::updateCalibration);
140 
141  connect(_widget.tableWidgetCompensate,
142  &QTableWidget::itemChanged,
143  this,
144  &FTSensorCalibrationGuiWidgetController::updateCompensation);
145 
146  loadDefaultArmar6FTR();
147  startTimer(10);
148  }
149 
151  {
152  }
153 
154  void
156  {
157  ARMARX_TRACE;
158  std::lock_guard g{_all_mutex};
159  _robot = addOrGetRobot("r", VirtualRobot::RobotIO::RobotDescription::eStructure);
160  }
161 
162  void
164  {
165  ARMARX_TRACE;
166  std::lock_guard g{_all_mutex};
167  stopRecording();
168  _comboboxes_are_set_up = false;
169  _robot = nullptr;
170  }
171 
172  void
174  {
175  ARMARX_TRACE;
176  std::lock_guard g{_all_mutex};
177  if (!_robot)
178  {
179  _widget.widgetFields->setEnabled(false);
180  return;
181  }
182  const auto to_list = [](const auto& container)
183  {
184  QStringList qnames;
185  for (const auto& name : container)
186  {
187  qnames << QString::fromStdString(name);
188  }
189  return qnames;
190  };
191  if (!_comboboxes_are_set_up)
192  {
193  {
194  const auto vec = getRobotUnit()->getLoggingNames();
195  _all_logging_names = std::set<std::string>(vec.begin(), vec.end());
196  }
197  const auto qnames = to_list(_all_logging_names);
198  const auto setup = [&](auto box, const auto& lst, auto regex)
199  {
200  box->clear();
201  box->addItems(lst);
202  const auto idx = lst.indexOf(QRegExp{regex});
203  if (idx >= 0)
204  {
205  box->setCurrentIndex(idx);
206  }
207  };
208  setup(_widget.comboBoxADC1Value, qnames, R"(^sens\.FT R\.adc_raw_1_to_3\.x$)");
209  setup(_widget.comboBoxADC2Value, qnames, R"(^sens\.FT R\.adc_raw_1_to_3\.y$)");
210  setup(_widget.comboBoxADC3Value, qnames, R"(^sens\.FT R\.adc_raw_1_to_3\.z$)");
211  setup(_widget.comboBoxADC4Value, qnames, R"(^sens\.FT R\.adc_raw_4_to_6\.x$)");
212  setup(_widget.comboBoxADC5Value, qnames, R"(^sens\.FT R\.adc_raw_4_to_6\.y$)");
213  setup(_widget.comboBoxADC6Value, qnames, R"(^sens\.FT R\.adc_raw_4_to_6\.z$)");
214 
215  setup(_widget.comboBoxADC1Temp, qnames, R"(^sens\.FT R\.adc_1_to_3_temperature$)");
216  setup(_widget.comboBoxADC2Temp, qnames, R"(^sens\.FT R\.adc_1_to_3_temperature$)");
217  setup(_widget.comboBoxADC3Temp, qnames, R"(^sens\.FT R\.adc_1_to_3_temperature$)");
218  setup(_widget.comboBoxADC4Temp, qnames, R"(^sens\.FT R\.adc_4_to_6_temperature$)");
219  setup(_widget.comboBoxADC5Temp, qnames, R"(^sens\.FT R\.adc_4_to_6_temperature$)");
220  setup(_widget.comboBoxADC6Temp, qnames, R"(^sens\.FT R\.adc_4_to_6_temperature$)");
221 
222  setup(
223  _widget.comboBoxKinematicChain, to_list(_robot->getRobotNodeSetNames()), "^Robot$");
224 
225  _widget.pushButtonStart->setEnabled(true);
226  _widget.widgetFields->setEnabled(true);
227  _comboboxes_are_set_up = true;
228  return;
229  }
230 
231  _widget.comboBoxADC1Value->setEnabled(!_recording);
232  _widget.comboBoxADC2Value->setEnabled(!_recording);
233  _widget.comboBoxADC3Value->setEnabled(!_recording);
234  _widget.comboBoxADC4Value->setEnabled(!_recording);
235  _widget.comboBoxADC5Value->setEnabled(!_recording);
236  _widget.comboBoxADC6Value->setEnabled(!_recording);
237 
238  _widget.comboBoxADC1Temp->setEnabled(!_recording);
239  _widget.comboBoxADC2Temp->setEnabled(!_recording);
240  _widget.comboBoxADC3Temp->setEnabled(!_recording);
241  _widget.comboBoxADC4Temp->setEnabled(!_recording);
242  _widget.comboBoxADC5Temp->setEnabled(!_recording);
243  _widget.comboBoxADC6Temp->setEnabled(!_recording);
244 
245  if (!_recording)
246  {
247  return;
248  }
250  //do transform, plotting and logging
251  {
252  auto& data = _streaming_handler->getDataBuffer();
253  setDebugObserverDatafield("number_of_timesteps", data.size());
254  long time_compensation_us = 0;
255  if (!data.empty())
256  {
257  const auto log = [&](auto n) { _logfile << ';' << n; };
258  for (const auto& s : data)
259  {
260  _logfile << s.iterationId << ';' << s.timestampUSec;
261  //logging
265  _logfile << '\n';
266  }
267  std::vector<float> vals;
268  {
269  const auto& last = data.back();
270  const auto pback = [&](auto n) { vals.emplace_back(n); };
272  RobotUnitDataStreamingReceiver::VisitEntries(pback, last, _adc_temp);
273  }
274  //calc + compensate
275 
276  Eigen::Vector6f raw_ft_unordered;
277  raw_ft_unordered[0] = vals.at(0);
278  raw_ft_unordered[1] = vals.at(1);
279  raw_ft_unordered[2] = vals.at(2);
280  raw_ft_unordered[3] = vals.at(3);
281  raw_ft_unordered[4] = vals.at(4);
282  raw_ft_unordered[5] = vals.at(5);
283 
284  Eigen::Vector6f temp_unordered;
285  temp_unordered[0] = vals.at(6 + 0);
286  temp_unordered[1] = vals.at(6 + 1);
287  temp_unordered[2] = vals.at(6 + 2);
288  temp_unordered[3] = vals.at(6 + 3);
289  temp_unordered[4] = vals.at(6 + 4);
290  temp_unordered[5] = vals.at(6 + 5);
291 
292  _widget.labelADC1Value->setText(QString::number(raw_ft_unordered(0)));
293  _widget.labelADC2Value->setText(QString::number(raw_ft_unordered(1)));
294  _widget.labelADC3Value->setText(QString::number(raw_ft_unordered(2)));
295  _widget.labelADC4Value->setText(QString::number(raw_ft_unordered(3)));
296  _widget.labelADC5Value->setText(QString::number(raw_ft_unordered(4)));
297  _widget.labelADC6Value->setText(QString::number(raw_ft_unordered(5)));
298 
299  _widget.labelADC1Temp->setText(QString::number(temp_unordered(0)));
300  _widget.labelADC2Temp->setText(QString::number(temp_unordered(1)));
301  _widget.labelADC3Temp->setText(QString::number(temp_unordered(2)));
302  _widget.labelADC4Temp->setText(QString::number(temp_unordered(3)));
303  _widget.labelADC5Temp->setText(QString::number(temp_unordered(4)));
304  _widget.labelADC6Temp->setText(QString::number(temp_unordered(5)));
305 
306  const auto do_compensation = [&]
307  {
308  const auto st = std::chrono::high_resolution_clock::now();
309  for (int i = 0; i < 6; ++i)
310  {
311  raw_ft_unordered(i) =
312  _comp_table.compensate(temp_unordered(i), raw_ft_unordered(i));
313  }
314  const auto dt = std::chrono::high_resolution_clock::now() - st;
315  time_compensation_us =
316  std::chrono::duration_cast<std::chrono::microseconds>(dt).count();
317  };
318 
319  if (_widget.radioButtonCompBeforeOffset->isChecked())
320  {
321  do_compensation();
322  }
323  raw_ft_unordered -= _offset;
324  if (_widget.radioButtonCompAfterOffset->isChecked())
325  {
326  do_compensation();
327  }
328  setDebugObserverDatafield("time_compensation_us", time_compensation_us);
329 
330  Eigen::Vector6f raw_ft;
331  raw_ft[0] = raw_ft_unordered(_channel_order(0));
332  raw_ft[1] = raw_ft_unordered(_channel_order(1));
333  raw_ft[2] = raw_ft_unordered(_channel_order(2));
334  raw_ft[3] = raw_ft_unordered(_channel_order(3));
335  raw_ft[4] = raw_ft_unordered(_channel_order(4));
336  raw_ft[5] = raw_ft_unordered(_channel_order(5));
337 
338  const Eigen::Vector6f ft = _conversion_matrix * (raw_ft * _ticks_to_volt_factor);
339 
340  //write to debug observer
341  setDebugObserverDatafield("fx", ft(0));
342  setDebugObserverDatafield("fy", ft(1));
343  setDebugObserverDatafield("fz", ft(2));
344  setDebugObserverDatafield("tx", ft(3));
345  setDebugObserverDatafield("ty", ft(4));
346  setDebugObserverDatafield("tz", ft(5));
347  }
348 
349  data.clear();
350  }
352  }
353 
354  void
355  FTSensorCalibrationGuiWidgetController::startRecording()
356  {
357  ARMARX_TRACE;
358  std::lock_guard g{_all_mutex};
359  _widget.pushButtonStart->setEnabled(false);
360  _widget.pushButtonStop->setEnabled(true);
361 
362  const std::array field_adc_value = {_widget.comboBoxADC1Value->currentText().toStdString(),
363  _widget.comboBoxADC2Value->currentText().toStdString(),
364  _widget.comboBoxADC3Value->currentText().toStdString(),
365  _widget.comboBoxADC4Value->currentText().toStdString(),
366  _widget.comboBoxADC5Value->currentText().toStdString(),
367  _widget.comboBoxADC6Value->currentText().toStdString()};
368 
369  const std::array field_adc_temp = {_widget.comboBoxADC1Temp->currentText().toStdString(),
370  _widget.comboBoxADC2Temp->currentText().toStdString(),
371  _widget.comboBoxADC3Temp->currentText().toStdString(),
372  _widget.comboBoxADC4Temp->currentText().toStdString(),
373  _widget.comboBoxADC5Temp->currentText().toStdString(),
374  _widget.comboBoxADC6Temp->currentText().toStdString()};
375 
376 
377  //setup streaming
378  {
379  RobotUnitDataStreaming::Config cfg;
380 
381  std::set<std::string> to_log;
382 
383  to_log.emplace(field_adc_value.at(0));
384  to_log.emplace(field_adc_value.at(1));
385  to_log.emplace(field_adc_value.at(2));
386  to_log.emplace(field_adc_value.at(3));
387  to_log.emplace(field_adc_value.at(4));
388  to_log.emplace(field_adc_value.at(5));
389 
390  to_log.emplace(field_adc_temp.at(0));
391  to_log.emplace(field_adc_temp.at(1));
392  to_log.emplace(field_adc_temp.at(2));
393  to_log.emplace(field_adc_temp.at(3));
394  to_log.emplace(field_adc_temp.at(4));
395  to_log.emplace(field_adc_temp.at(5));
396 
397 
398  ///TODO
399  //filter by rns
400  const auto rns_name = _widget.comboBoxKinematicChain->currentText().toStdString();
401  ARMARX_CHECK_EXPRESSION(_robot->hasRobotNodeSet(rns_name)) << VAROUT(rns_name);
402  for (const auto& name : _robot->getRobotNodeSet(rns_name)->getNodeNames())
403  {
404  auto dataf = "sens." + name + ".position";
405  if (_all_logging_names.count(dataf))
406  {
407  to_log.emplace(std::move(dataf));
408  }
409  }
410  cfg.loggingNames.insert(cfg.loggingNames.end(), to_log.begin(), to_log.end());
411  _streaming_handler =
412  make_shared<RobotUnitDataStreamingReceiver>(this, getRobotUnit(), cfg);
413  }
414  //setup csv log + indices
415  {
416  auto entries = _streaming_handler->getDataDescription().entries;
417  for (std::size_t i = 0; i < 6; ++i)
418  {
419  ARMARX_CHECK_EXPRESSION(entries.count(field_adc_value.at(i)))
420  << VAROUT(field_adc_value.at(i));
421  ARMARX_CHECK_EXPRESSION(entries.count(field_adc_temp.at(i)))
422  << VAROUT(field_adc_temp.at(i));
423  _adc.at(i) = entries.at(field_adc_value.at(i));
424  _adc_temp.at(i) = entries.at(field_adc_temp.at(i));
425  }
426  for (std::size_t i = 0; i < 6; ++i)
427  {
428  entries.erase(field_adc_value.at(i));
429  entries.erase(field_adc_temp.at(i));
430  }
431 
432  const std::filesystem::path path =
434  _widget.lineEditLogFile->text().toStdString());
435  if (path.has_parent_path())
436  {
437  std::filesystem::create_directories(path.parent_path());
438  }
439  ARMARX_INFO << "Logging to " << path;
440  _logfile.open(path.string());
441  _logfile << "iteration;timestamp;adc1;adc2;adc3;adc4;adc5;acd1_temp;acd2_temp;acd3_"
442  "temp;acd4_temp;acd5_temp";
443 
444  for (const auto& [name, entry] : entries)
445  {
446  _joints.emplace_back(entry);
447  _logfile << ';' << name;
448  }
449  _logfile << std::endl;
450  }
451 
452  _recording = true;
453  }
454 
455  void
456  FTSensorCalibrationGuiWidgetController::stopRecording()
457  {
458  ARMARX_TRACE;
459  std::lock_guard g{_all_mutex};
460  _widget.pushButtonStart->setEnabled(true);
461  _widget.pushButtonStop->setEnabled(false);
462  _recording = false;
463  _streaming_handler = nullptr;
464  _logfile = std::ofstream{};
465  }
466 
467  template <class T>
468  T
469  str_to_val(const auto& str)
470  {
471 #define option(type, fn) \
472  if constexpr (std::is_same_v<T, type>) \
473  { \
474  return str.fn(); \
475  } \
476  else
477  option(double, toDouble) option(float, toFloat) option(int, toInt) option(long, toLong)
478  option(qlonglong, toLongLong) option(short, toShort) option(uint, toUInt)
479  option(ulong, toULong) option(qulonglong, toULongLong) option(ushort, toUShort)
480  {
481  static_assert(!std::is_same_v<float_t, float_t>,
482  "this function can't handle the given type");
483  }
484 #undef option
485  }
486 
487  template <class T>
488  void
489  str_to_val(const auto& str, T& val)
490  {
491  val = str_to_val<T>(str);
492  }
493 
494  template <class T>
495  T
497  {
498  return str.isEmpty() ? opt : str_to_val<T>(str);
499  ;
500  }
501 
502  void
503  read(auto& eigen, auto* table)
504  {
505  for (int c = 0; c < eigen.cols(); ++c)
506  {
507  for (int r = 0; r < eigen.rows(); ++r)
508  {
509  auto it = table->item(r, c);
511  QString str = it->text();
512  if (str.isEmpty())
513  {
514  str = "0";
515  }
516  str_to_val(it->text(), eigen(r, c));
517  }
518  }
519  }
520 
521  void
522  FTSensorCalibrationGuiWidgetController::updateCalibration()
523  {
524  ARMARX_TRACE;
525  //read all tables:
526  read(_conversion_matrix, _widget.tableWidgetMatrix);
527  read(_offset, _widget.tableWidgetOffset);
528  read(_channel_order, _widget.tableWidgetChannelOrder);
529  _ticks_to_volt_factor = _widget.doubleSpinBoxTickToVolt->value() *
530  std::pow(10.0, 1.0 * _widget.doubleSpinBoxTickToVoltE->value());
531  }
532 
533  void
534  FTSensorCalibrationGuiWidgetController::updateCompensation()
535  {
536  ARMARX_TRACE;
537  _comp_table.table.clear();
538  const auto maxRows = _widget.tableWidgetCompensate->rowCount();
539  //read all tables:
540  for (int r = 0; r < maxRows; ++r)
541  {
542  const auto read_cell = [&](int col)
543  {
544  auto it = _widget.tableWidgetCompensate->item(r, col);
546  return it->text();
547  };
548  const auto c0 = read_cell(0);
549  if (c0.isEmpty())
550  {
551  continue;
552  }
553 
554  _comp_table.table.emplace_back(
555  std::array{str_to_val<float>(c0),
556  str_to_val_with_opt_on_empty<float>(read_cell(1), 0),
557  str_to_val_with_opt_on_empty<float>(read_cell(2), 0)});
558  std::sort(_comp_table.table.begin(), _comp_table.table.end());
559  }
560  }
561 
562  void
563  FTSensorCalibrationGuiWidgetController::loadCalibFromFile()
564  {
565  ARMARX_TRACE;
566  }
567 
568  void
569  FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTR()
570  {
571  ARMARX_TRACE;
572  const auto set = [&](auto tab, auto row, auto col, auto str)
573  {
574  auto it = tab->item(row, col);
575  ARMARX_CHECK_NOT_NULL(it) << VAROUT(tab->objectName()) << '\n'
576  << VAROUT(row) << " / " << VAROUT(col);
577  it->setText(str);
578  };
579  set(_widget.tableWidgetMatrix, 0, 0, "-467.643251792");
580  set(_widget.tableWidgetMatrix, 0, 1, "91.3750529228");
581  set(_widget.tableWidgetMatrix, 0, 2, "2494.4447796887");
582  set(_widget.tableWidgetMatrix, 0, 3, "-21630.9316531438");
583  set(_widget.tableWidgetMatrix, 0, 4, "-2015.8633957692");
584  set(_widget.tableWidgetMatrix, 0, 5, "21220.5317464812");
585 
586  set(_widget.tableWidgetMatrix, 1, 0, "-632.4535042867");
587  set(_widget.tableWidgetMatrix, 1, 1, "26666.445463403");
588  set(_widget.tableWidgetMatrix, 1, 2, "888.174687977");
589  set(_widget.tableWidgetMatrix, 1, 3, "-12567.7138845759");
590  set(_widget.tableWidgetMatrix, 1, 4, "2056.9631948303");
591  set(_widget.tableWidgetMatrix, 1, 5, "-12362.9602817359");
592 
593  set(_widget.tableWidgetMatrix, 2, 0, "32117.1345018829");
594  set(_widget.tableWidgetMatrix, 2, 1, "1042.3739547082");
595  set(_widget.tableWidgetMatrix, 2, 2, "32619.3235489089");
596  set(_widget.tableWidgetMatrix, 2, 3, "401.9862056573");
597  set(_widget.tableWidgetMatrix, 2, 4, "32571.279999299");
598  set(_widget.tableWidgetMatrix, 2, 5, "1238.1723510684");
599 
600  set(_widget.tableWidgetMatrix, 3, 0, "-7.9924072503");
601  set(_widget.tableWidgetMatrix, 3, 1, "183.6989072793");
602  set(_widget.tableWidgetMatrix, 3, 2, "-528.3700035934");
603  set(_widget.tableWidgetMatrix, 3, 3, "-95.0326724598");
604  set(_widget.tableWidgetMatrix, 3, 4, "529.7112223958");
605  set(_widget.tableWidgetMatrix, 3, 5, "-67.4388404574");
606 
607  set(_widget.tableWidgetMatrix, 4, 0, "601.7174062086");
608  set(_widget.tableWidgetMatrix, 4, 1, "19.2614267838");
609  set(_widget.tableWidgetMatrix, 4, 2, "-343.4582260308");
610  set(_widget.tableWidgetMatrix, 4, 3, "144.3830278106");
611  set(_widget.tableWidgetMatrix, 4, 4, "-284.5086278763");
612  set(_widget.tableWidgetMatrix, 4, 5, "-156.6756177634");
613 
614  set(_widget.tableWidgetMatrix, 5, 0, "6.7801800162");
615  set(_widget.tableWidgetMatrix, 5, 1, "-339.2302595085");
616  set(_widget.tableWidgetMatrix, 5, 2, "35.4255085497");
617  set(_widget.tableWidgetMatrix, 5, 3, "-320.187165265");
618  set(_widget.tableWidgetMatrix, 5, 4, "40.6862246688");
619  set(_widget.tableWidgetMatrix, 5, 5, "-314.5800995414");
620 
621  set(_widget.tableWidgetOffset, 0, 0, "0");
622  set(_widget.tableWidgetOffset, 1, 0, "0");
623  set(_widget.tableWidgetOffset, 2, 0, "0");
624  set(_widget.tableWidgetOffset, 3, 0, "0");
625  set(_widget.tableWidgetOffset, 4, 0, "0");
626  set(_widget.tableWidgetOffset, 5, 0, "0");
627 
628  set(_widget.tableWidgetChannelOrder, 0, 0, "0");
629  set(_widget.tableWidgetChannelOrder, 1, 0, "1");
630  set(_widget.tableWidgetChannelOrder, 2, 0, "2");
631  set(_widget.tableWidgetChannelOrder, 3, 0, "3");
632  set(_widget.tableWidgetChannelOrder, 4, 0, "4");
633  set(_widget.tableWidgetChannelOrder, 5, 0, "5");
634 
635  _widget.doubleSpinBoxTickToVolt->setValue(-7.275957614183426);
636  _widget.doubleSpinBoxTickToVoltE->setValue(-12);
637  }
638 
639  void
640  FTSensorCalibrationGuiWidgetController::loadDefaultArmar6FTL()
641  {
642  ARMARX_TRACE;
643  const auto set = [&](auto tab, auto row, auto col, auto str)
644  {
645  auto it = tab->item(row, col);
646  ARMARX_CHECK_NOT_NULL(it) << VAROUT(tab->objectName()) << '\n'
647  << VAROUT(row) << " / " << VAROUT(col);
648  it->setText(str);
649  };
650  set(_widget.tableWidgetMatrix, 0, 0, "243.0341527991");
651  set(_widget.tableWidgetMatrix, 0, 1, "101.5053757216");
652  set(_widget.tableWidgetMatrix, 0, 2, "3363.1141700153");
653  set(_widget.tableWidgetMatrix, 0, 3, "-22042.8003987865");
654  set(_widget.tableWidgetMatrix, 0, 4, "-1473.1343892481");
655  set(_widget.tableWidgetMatrix, 0, 5, "22371.6116908654");
656 
657  set(_widget.tableWidgetMatrix, 1, 0, "-2855.7194248476");
658  set(_widget.tableWidgetMatrix, 1, 1, "26276.7522410658");
659  set(_widget.tableWidgetMatrix, 1, 2, "1998.8250953037");
660  set(_widget.tableWidgetMatrix, 1, 3, "-12713.8569146837");
661  set(_widget.tableWidgetMatrix, 1, 4, "298.7344647758");
662  set(_widget.tableWidgetMatrix, 1, 5, "-12925.3451059361");
663 
664  set(_widget.tableWidgetMatrix, 2, 0, "32124.3594508476");
665  set(_widget.tableWidgetMatrix, 2, 1, "1084.8849712208");
666  set(_widget.tableWidgetMatrix, 2, 2, "32074.9427983169");
667  set(_widget.tableWidgetMatrix, 2, 3, "1590.5268672115");
668  set(_widget.tableWidgetMatrix, 2, 4, "31332.9720074452");
669  set(_widget.tableWidgetMatrix, 2, 5, "1975.0541066964");
670 
671  set(_widget.tableWidgetMatrix, 3, 0, "-16.374713716");
672  set(_widget.tableWidgetMatrix, 3, 1, "180.8318075047");
673  set(_widget.tableWidgetMatrix, 3, 2, "-507.7906728024");
674  set(_widget.tableWidgetMatrix, 3, 3, "-111.2589978068");
675  set(_widget.tableWidgetMatrix, 3, 4, "503.7542430159");
676  set(_widget.tableWidgetMatrix, 3, 5, "-59.7462546316");
677 
678  set(_widget.tableWidgetMatrix, 4, 0, "598.6997045889");
679  set(_widget.tableWidgetMatrix, 4, 1, "15.4552761047");
680  set(_widget.tableWidgetMatrix, 4, 2, "-323.6960410703");
681  set(_widget.tableWidgetMatrix, 4, 3, "137.7987236203");
682  set(_widget.tableWidgetMatrix, 4, 4, "-296.3155623038");
683  set(_widget.tableWidgetMatrix, 4, 5, "-171.7206902305");
684 
685  set(_widget.tableWidgetMatrix, 5, 0, "49.6982738536");
686  set(_widget.tableWidgetMatrix, 5, 1, "-335.3035629766");
687  set(_widget.tableWidgetMatrix, 5, 2, "43.0493257519");
688  set(_widget.tableWidgetMatrix, 5, 3, "-323.8948308006");
689  set(_widget.tableWidgetMatrix, 5, 4, "15.3044378249");
690  set(_widget.tableWidgetMatrix, 5, 5, "-329.7565028853");
691 
692  set(_widget.tableWidgetOffset, 0, 0, "0");
693  set(_widget.tableWidgetOffset, 1, 0, "0");
694  set(_widget.tableWidgetOffset, 2, 0, "0");
695  set(_widget.tableWidgetOffset, 3, 0, "0");
696  set(_widget.tableWidgetOffset, 4, 0, "0");
697  set(_widget.tableWidgetOffset, 5, 0, "0");
698 
699  set(_widget.tableWidgetChannelOrder, 0, 0, "0");
700  set(_widget.tableWidgetChannelOrder, 1, 0, "1");
701  set(_widget.tableWidgetChannelOrder, 2, 0, "2");
702  set(_widget.tableWidgetChannelOrder, 3, 0, "3");
703  set(_widget.tableWidgetChannelOrder, 4, 0, "4");
704  set(_widget.tableWidgetChannelOrder, 5, 0, "5");
705 
706  _widget.doubleSpinBoxTickToVolt->setValue(-7.275957614183426);
707  _widget.doubleSpinBoxTickToVoltE->setValue(-12);
708  }
709 } // namespace armarx
armarx::toUInt
unsigned int toUInt(const std::string &input)
Definition: StringHelpers.cpp:122
str
std::string str(const T &t)
Definition: UserAssistedSegmenterGuiWidgetController.cpp:43
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:111
armarx::FTSensorCalibrationGuiWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: FTSensorCalibrationGuiWidgetController.cpp:65
FTSensorCalibrationGuiWidgetController.h
armarx::DebugObserverComponentPluginUser::getDebugObserverComponentPlugin
plugins::DebugObserverComponentPlugin & getDebugObserverComponentPlugin()
Definition: DebugObserverComponentPlugin.cpp:89
armarx::DebugObserverComponentPluginUser::setDebugObserverBatchModeEnabled
void setDebugObserverBatchModeEnabled(bool enable)
Definition: DebugObserverComponentPlugin.cpp:129
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::DebugObserverComponentPluginUser::setDebugObserverDatafield
void setDebugObserverDatafield(Ts &&... ts) const
Definition: DebugObserverComponentPlugin.h:86
armarx::toFloat
float toFloat(const std::string &input)
Converts a string to float and uses always dot as seperator.
Definition: StringHelpers.cpp:100
trace.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::plugins::RobotStateComponentPlugin::setRobotStateComponentName
void setRobotStateComponentName(const std::string &name)
Definition: RobotStateComponentPlugin.cpp:336
armarx::compensation_table::compensate
value_t compensate(value_t decision, value_t value) const
Definition: FTSensorCalibrationGuiWidgetController.h:61
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:77
armarx::FTSensorCalibrationGuiWidgetController::~FTSensorCalibrationGuiWidgetController
virtual ~FTSensorCalibrationGuiWidgetController()
Definition: FTSensorCalibrationGuiWidgetController.cpp:150
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::RobotStateComponentPluginUser::getRobotStateComponentPlugin
const RobotStateComponentPlugin & getRobotStateComponentPlugin() const
Definition: RobotStateComponentPlugin.cpp:375
armarx::str_to_val
T str_to_val(const auto &str)
Definition: FTSensorCalibrationGuiWidgetController.cpp:469
armarx::read
void read(auto &eigen, auto *table)
Definition: FTSensorCalibrationGuiWidgetController.cpp:503
armarx::FTSensorCalibrationGuiWidgetController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: FTSensorCalibrationGuiWidgetController.cpp:163
armarx::RobotUnitDataStreamingReceiver::VisitEntries
static void VisitEntries(auto &&f, const timestep_t &st, const auto &cont)
Definition: RobotUnitDataStreamingReceiver.h:296
armarx::FTSensorCalibrationGuiWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: FTSensorCalibrationGuiWidgetController.cpp:81
armarx::FTSensorCalibrationGuiWidgetController::FTSensorCalibrationGuiWidgetController
FTSensorCalibrationGuiWidgetController()
Definition: FTSensorCalibrationGuiWidgetController.cpp:94
armarx::compensation_table::table
std::vector< entry_t > table
Definition: FTSensorCalibrationGuiWidgetController.h:46
armarx::RobotStateComponentPluginUser::addOrGetRobot
VirtualRobot::RobotPtr addOrGetRobot(const std::string &id, Ts &&... ts)
Definition: RobotStateComponentPlugin.h:207
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::FTSensorCalibrationGuiWidgetController::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: FTSensorCalibrationGuiWidgetController.cpp:155
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:198
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:135
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:37
T
float T
Definition: UnscentedKalmanFilterTest.cpp:38
armarx::FTSensorCalibrationGuiWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: FTSensorCalibrationGuiWidgetController.cpp:50
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:496
armarx::FTSensorCalibrationGuiWidgetController::timerEvent
void timerEvent(QTimerEvent *event) override
Definition: FTSensorCalibrationGuiWidgetController.cpp:173
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:92
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:45
armarx::SimpleConfigDialog
A config-dialog containing one (or multiple) proxy finders.
Definition: SimpleConfigDialog.h:84