KinematicUnitGuiPlugin.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #include "KinematicUnitGuiPlugin.h"
25 
26 #include <SimoxUtility/algorithm/string.h>
27 #include <SimoxUtility/json.h>
28 #include <VirtualRobot/XML/RobotIO.h>
29 
42 
43 #include <RobotAPI/gui-plugins/KinematicUnitPlugin/ui_KinematicUnitConfigDialog.h>
44 #include <RobotAPI/interface/core/NameValueMap.h>
45 #include <RobotAPI/interface/units/KinematicUnitInterface.h>
46 
48 
49 // Qt headers
50 #include <QCheckBox>
51 #include <QClipboard>
52 #include <QInputDialog>
53 #include <QPushButton>
54 #include <QSlider>
55 #include <QSpinBox>
56 #include <QStringList>
57 #include <QTableView>
58 #include <QTableWidget>
59 #include <Qt>
60 #include <QtGlobal>
61 #include <qtimer.h>
62 
64 
65 #include <Inventor/Qt/SoQt.h>
66 #include <Inventor/SoDB.h>
67 
68 // System
69 #include <cmath>
70 #include <cstddef>
71 #include <cstdio>
72 #include <cstdlib>
73 #include <filesystem>
74 #include <iostream>
75 #include <memory>
76 #include <optional>
77 #include <stdexcept>
78 #include <string>
79 
80 
81 //#define KINEMATIC_UNIT_FILE_DEFAULT std::string("RobotAPI/robots/Armar3/ArmarIII.xml")
82 //#define KINEMATIC_UNIT_FILE_DEFAULT_PACKAGE std::string("RobotAPI")
83 #define KINEMATIC_UNIT_NAME_DEFAULT "Robot"
84 //#define TOPIC_NAME_DEFAULT "RobotState"
85 
86 constexpr float SLIDER_POS_DEG_MULTIPLIER = 5;
87 constexpr float SLIDER_POS_RAD_MULTIPLIER = 100;
88 constexpr float SLIDER_POS_HEMI_MULTIPLIER = 100;
89 
90 namespace armarx
91 {
92 
94  {
95 
96  qRegisterMetaType<DebugInfo>("DebugInfo");
97 
98  addWidget<KinematicUnitWidgetController>();
99  }
100 
102  kinematicUnitNode(nullptr),
103  enableValueValidator(true),
104  historyTime(100000), // 1/10 s
105  currentValueMax(5.0f)
106  {
107  rootVisu = NULL;
108  debugLayerVisu = NULL;
109 
110  // init gui
111  ui.setupUi(getWidget());
112  getWidget()->setEnabled(false);
113 
114  ui.tableJointList->setItemDelegateForColumn(eTabelColumnAngleProgressbar, &delegate);
115 
116  ui.radioButtonUnknown->setHidden(true);
117  }
118 
119  void
121  {
122  ARMARX_INFO << flush;
123  verbose = true;
124 
125 
126  rootVisu = new SoSeparator;
127  rootVisu->ref();
128  robotVisu = new SoSeparator;
129  robotVisu->ref();
130  rootVisu->addChild(robotVisu);
131 
132  // create the debugdrawer component
133  std::string debugDrawerComponentName = "KinemticUnitGUIDebugDrawer_" + getName();
134  ARMARX_INFO << "Creating component " << debugDrawerComponentName;
135  debugDrawer =
136  Component::create<DebugDrawerComponent>(getIceProperties(), debugDrawerComponentName);
137  showVisuLayers(false);
138 
139  if (mutex3D)
140  {
141  //ARMARX_IMPORTANT << "mutex3d:" << mutex3D.get();
142  debugDrawer->setMutex(mutex3D);
143  }
144  else
145  {
146  ARMARX_ERROR << " No 3d mutex available...";
147  }
148 
150  m->addObject(debugDrawer, false);
151 
152 
153  {
154  std::unique_lock lock(*mutex3D);
155  debugLayerVisu = new SoSeparator();
156  debugLayerVisu->ref();
157  debugLayerVisu->addChild(debugDrawer->getVisualization());
158  rootVisu->addChild(debugLayerVisu);
159  }
160 
161  connectSlots();
162 
164  }
165 
166  void
168  {
169  // ARMARX_INFO << "Kinematic Unit Gui :: onConnectComponent()";
170  jointCurrentHistory.clear();
171  jointCurrentHistory.set_capacity(5);
172 
173  // jointAnglesUpdateFrequency = new filters::MedianFilter(100);
174  kinematicUnitInterfacePrx = getProxy<KinematicUnitInterfacePrx>(kinematicUnitName);
175 
176  lastJointAngleUpdateTimestamp = Clock::Now();
177  robotVisu->removeAllChildren();
178 
179  robot.reset();
180 
181  std::string rfile;
182  Ice::StringSeq includePaths;
183 
184  // Get robot filename
185  try
186  {
187  Ice::StringSeq packages = kinematicUnitInterfacePrx->getArmarXPackages();
188  packages.push_back(Application::GetProjectName());
189  ARMARX_VERBOSE << "ArmarX packages " << packages;
190 
191  for (const std::string& projectName : packages)
192  {
193  if (projectName.empty())
194  {
195  continue;
196  }
197 
198  CMakePackageFinder project(projectName);
199  auto pathsString = project.getDataDir();
200  ARMARX_VERBOSE << "Data paths of ArmarX package " << projectName << ": "
201  << pathsString;
202  Ice::StringSeq projectIncludePaths = Split(pathsString, ";,", true, true);
203  ARMARX_VERBOSE << "Result: Data paths of ArmarX package " << projectName << ": "
204  << projectIncludePaths;
205  includePaths.insert(
206  includePaths.end(), projectIncludePaths.begin(), projectIncludePaths.end());
207  }
208 
209  rfile = kinematicUnitInterfacePrx->getRobotFilename();
210  ARMARX_VERBOSE << "Relative robot file " << rfile;
211  ArmarXDataPath::getAbsolutePath(rfile, rfile, includePaths);
212  ARMARX_VERBOSE << "Absolute robot file " << rfile;
213 
214  robotNodeSetName = kinematicUnitInterfacePrx->getRobotNodeSetName();
215  }
216  catch (...)
217  {
218  ARMARX_ERROR << "Unable to retrieve robot filename.";
219  }
220 
221  try
222  {
223  ARMARX_INFO << "Loading robot from file " << rfile;
224  robot = loadRobotFile(rfile);
225  }
226  catch (const std::exception& e)
227  {
228  ARMARX_ERROR << "Failed to init robot: " << e.what();
229  }
230  catch (...)
231  {
232  ARMARX_ERROR << "Failed to init robot";
233  }
234 
235  if (!robot || !robot->hasRobotNodeSet(robotNodeSetName))
236  {
237  getObjectScheduler()->terminate();
238  if (getWidget()->parentWidget())
239  {
240  getWidget()->parentWidget()->close();
241  }
242  return;
243  }
244 
245  // Check robot name and disable setZero Button if necessary
246  if (not simox::alg::starts_with(robot->getName(), "Armar3"))
247  {
248  ARMARX_VERBOSE << "Disable the SetZero button because the robot name is '"
249  << robot->getName() << "'.";
250  ui.pushButtonKinematicUnitPos1->setDisabled(true);
251  }
252 
253  kinematicUnitFile = rfile;
254  robotNodeSet = robot->getRobotNodeSet(robotNodeSetName);
255 
256  kinematicUnitVisualization = getCoinVisualization(robot);
257  kinematicUnitNode = kinematicUnitVisualization->getCoinVisualization();
258  robotVisu->addChild(kinematicUnitNode);
259 
260  // Fetch the current joint angles.
262 
263  initGUIComboBox(robotNodeSet); // init the pull down menu (QT: ComboBox)
264  initGUIJointListTable(robotNodeSet);
265 
266  const auto initialDebugInfo = kinematicUnitInterfacePrx->getDebugInfo();
267 
268  initializeUi(initialDebugInfo);
269 
270  QMetaObject::invokeMethod(this, "resetSlider");
271  enableMainWidgetAsync(true);
272 
275  updateTask->start();
276  }
277 
278  void
280  {
281  Metronome metronome(Frequency::Hertz(10));
282 
284  {
285  fetchData();
286  metronome.waitForNextTick();
287  }
288 
289  ARMARX_INFO << "Connection to kinemetic unit lost. Update task terminates.";
290  }
291 
292  void
294  {
295  kinematicUnitInterfacePrx = nullptr;
296 
297  if (updateTask)
298  {
299  updateTask->stop();
300  updateTask->join();
301  updateTask = nullptr;
302  }
303 
304  // killTimer(updateTimerId);
305  enableMainWidgetAsync(false);
306 
307  {
308  std::unique_lock lock(mutexNodeSet);
309  robot.reset();
310  robotNodeSet.reset();
311  currentNode.reset();
312  }
313 
314  {
315  std::unique_lock lock(*mutex3D);
316  robotVisu->removeAllChildren();
317  debugLayerVisu->removeAllChildren();
318  }
319  }
320 
321  void
323  {
324  kinematicUnitInterfacePrx = nullptr;
325 
326  if (updateTask)
327  {
328  updateTask->stop();
329  updateTask->join();
330  updateTask = nullptr;
331  }
332 
333  enableMainWidgetAsync(false);
334 
335  {
336  std::unique_lock lock(*mutex3D);
337 
338  if (robotVisu)
339  {
340  robotVisu->removeAllChildren();
341  robotVisu->unref();
342  robotVisu = NULL;
343  }
344 
345  if (debugLayerVisu)
346  {
347  debugLayerVisu->removeAllChildren();
348  debugLayerVisu->unref();
349  debugLayerVisu = NULL;
350  }
351 
352  if (rootVisu)
353  {
354  rootVisu->removeAllChildren();
355  rootVisu->unref();
356  rootVisu = NULL;
357  }
358  }
359 
360  /*
361  if (debugDrawer && debugDrawer->getObjectScheduler())
362  {
363  ARMARX_INFO << "Removing DebugDrawer component...";
364  debugDrawer->getObjectScheduler()->terminate();
365  ARMARX_INFO << "Removing DebugDrawer component...done";
366  }
367  */
368  }
369 
370  QPointer<QDialog>
372  {
373  if (!dialog)
374  {
375  dialog = new KinematicUnitConfigDialog(parent);
376  dialog->setName(dialog->getDefaultName());
377  }
378 
379  return qobject_cast<KinematicUnitConfigDialog*>(dialog);
380  }
381 
382  void
384  {
385  ARMARX_VERBOSE << "KinematicUnitWidget::configured()";
386  kinematicUnitName = dialog->proxyFinder->getSelectedProxyName().toStdString();
387  enableValueValidator = dialog->ui->checkBox->isChecked();
388  viewerEnabled = dialog->ui->checkBox3DViewerEnabled->isChecked();
389  historyTime = dialog->ui->spinBoxHistory->value() * 1000;
390  currentValueMax = dialog->ui->doubleSpinBoxMaxMinCurrent->value();
391  }
392 
393  void
395  {
396  kinematicUnitName = settings->value("kinematicUnitName", KINEMATIC_UNIT_NAME_DEFAULT)
397  .toString()
398  .toStdString();
399  enableValueValidator = settings->value("enableValueValidator", true).toBool();
400  viewerEnabled = settings->value("viewerEnabled", true).toBool();
401  historyTime = settings->value("historyTime", 100).toInt() * 1000;
402  currentValueMax = settings->value("currentValueMax", 5.0).toFloat();
403  }
404 
405  void
407  {
408  settings->setValue("kinematicUnitName", QString::fromStdString(kinematicUnitName));
409  settings->setValue("enableValueValidator", enableValueValidator);
410  settings->setValue("viewerEnabled", viewerEnabled);
411  assert(historyTime % 1000 == 0);
412  settings->setValue("historyTime", static_cast<int>(historyTime / 1000));
413  settings->setValue("currentValueMax", currentValueMax);
414  }
415 
416  void
418  {
419  if (debugDrawer)
420  {
421  if (show)
422  {
423  debugDrawer->enableAllLayers();
424  }
425  else
426  {
427  debugDrawer->disableAllLayers();
428  }
429  }
430  }
431 
432  void
434  {
436  {
437  std::unique_lock lock(mutexNodeSet);
438 
440  const auto debugInfo = kinematicUnitInterfacePrx->getDebugInfo();
441 
442  const auto selectedControlMode = getSelectedControlMode();
443 
444  if (selectedControlMode == ePositionControl)
445  {
446  values = debugInfo.jointAngles;
447  }
448  else if (selectedControlMode == eVelocityControl)
449  {
450  values = debugInfo.jointVelocities;
451  }
452  }
453 
454  JSONObjectPtr serializer = new JSONObject();
455  for (auto& kv : values)
456  {
457  serializer->setFloat(kv.first, kv.second);
458  }
459  const QString json = QString::fromStdString(serializer->asString(true));
460  QClipboard* clipboard = QApplication::clipboard();
461  clipboard->setText(json);
462  QApplication::processEvents();
463  }
464 
465  void
467  {
468  // modelUpdateCB();
469  }
470 
471  void
473  {
474  }
475 
476  void
478  {
479  }
480 
481  SoNode*
483  {
484  if (viewerEnabled)
485  {
486  ARMARX_INFO << "Returning scene ";
487  return rootVisu;
488  }
489  else
490  {
491  ARMARX_INFO << "viewer disabled - returning null scene";
492  return NULL;
493  }
494  }
495 
496  void
498  {
499  connect(ui.pushButtonKinematicUnitPos1,
500  SIGNAL(clicked()),
501  this,
502  SLOT(kinematicUnitZeroPosition()));
503 
504  connect(
505  ui.nodeListComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectJoint(int)));
506  connect(ui.horizontalSliderKinematicUnitPos,
507  SIGNAL(valueChanged(int)),
508  this,
509  SLOT(sliderValueChanged(int)));
510 
511  connect(ui.horizontalSliderKinematicUnitPos,
512  SIGNAL(sliderReleased()),
513  this,
514  SLOT(resetSliderToZeroPosition()));
515 
516  connect(ui.radioButtonPositionControl,
517  SIGNAL(clicked(bool)),
518  this,
519  SLOT(setControlModePosition()));
520  connect(ui.radioButtonVelocityControl,
521  SIGNAL(clicked(bool)),
522  this,
523  SLOT(setControlModeVelocity()));
524  connect(
525  ui.radioButtonTorqueControl, SIGNAL(clicked(bool)), this, SLOT(setControlModeTorque()));
526  connect(
527  ui.pushButtonFromJson, SIGNAL(clicked()), this, SLOT(on_pushButtonFromJson_clicked()));
528 
529  connect(ui.copyToClipboard, SIGNAL(clicked()), this, SLOT(copyToClipboard()));
530  connect(ui.showDebugLayer,
531  SIGNAL(toggled(bool)),
532  this,
533  SLOT(showVisuLayers(bool)),
534  Qt::QueuedConnection);
535 
536  connect(this,
537  SIGNAL(jointAnglesReported()),
538  this,
539  SLOT(updateJointAnglesTable()),
540  Qt::QueuedConnection);
541  connect(this,
542  SIGNAL(jointVelocitiesReported()),
543  this,
545  Qt::QueuedConnection);
546  connect(this,
547  SIGNAL(jointTorquesReported()),
548  this,
549  SLOT(updateJointTorquesTable()),
550  Qt::QueuedConnection);
551  connect(this,
552  SIGNAL(jointCurrentsReported()),
553  this,
554  SLOT(updateJointCurrentsTable()),
555  Qt::QueuedConnection);
556  connect(this,
558  this,
560  Qt::QueuedConnection);
561  connect(this,
562  SIGNAL(jointControlModesReported()),
563  this,
564  SLOT(updateControlModesTable()),
565  Qt::QueuedConnection);
566  connect(this,
567  SIGNAL(jointStatusesReported()),
568  this,
569  SLOT(updateJointStatusesTable()),
570  Qt::QueuedConnection);
571 
572  connect(ui.tableJointList,
573  SIGNAL(cellDoubleClicked(int, int)),
574  this,
575  SLOT(selectJointFromTableWidget(int, int)),
576  Qt::QueuedConnection);
577 
578  connect(ui.checkBoxUseDegree,
579  SIGNAL(clicked()),
580  this,
581  SLOT(resetSlider()),
582  Qt::QueuedConnection);
583  connect(ui.checkBoxUseDegree, SIGNAL(clicked()), this, SLOT(setControlModePosition()));
584  connect(ui.checkBoxUseDegree, SIGNAL(clicked()), this, SLOT(setControlModeVelocity()));
585  connect(ui.checkBoxUseDegree, SIGNAL(clicked()), this, SLOT(setControlModeTorque()));
586 
587  connect(this,
588  SIGNAL(onDebugInfoReceived(const DebugInfo&)),
589  this,
590  SLOT(debugInfoReceived(const DebugInfo&)));
591  }
592 
593  void
595  {
596  //signal clicked is not emitted if you call setDown(), setChecked() or toggle().
597 
598  // there is no default control mode
599  setControlModeRadioButtonGroup(ControlMode::eUnknown);
600 
601  ui.widgetSliderFactor->setVisible(false);
602 
603  fetchData();
604  }
605 
606  void
608  {
609  if (!robotNodeSet)
610  {
611  return;
612  }
613 
614  std::unique_lock lock(mutexNodeSet);
615  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
616  NameValueMap vels;
617  NameControlModeMap jointModes;
618 
619  for (unsigned int i = 0; i < rn.size(); i++)
620  {
621  jointModes[rn[i]->getName()] = eVelocityControl;
622  vels[rn[i]->getName()] = 0.0f;
623  }
624 
625  try
626  {
627  kinematicUnitInterfacePrx->switchControlMode(jointModes);
628  kinematicUnitInterfacePrx->setJointVelocities(vels);
629  }
630  catch (...)
631  {
632  }
633 
634  const auto selectedControlMode = getSelectedControlMode();
635  if (selectedControlMode == eVelocityControl)
636  {
637  ui.horizontalSliderKinematicUnitPos->setSliderPosition(SLIDER_ZERO_POSITION);
638  }
639  }
640 
641  void
643  {
644  const auto selectedControlMode = getSelectedControlMode();
645 
646  if (selectedControlMode == eVelocityControl || selectedControlMode == eTorqueControl)
647  {
649  }
650  else if (selectedControlMode == ePositionControl)
651  {
652  if (currentNode)
653  {
654  if (currentNode->isRotationalJoint() or currentNode->isHemisphereJoint() or
655  currentNode->isFourBarJoint())
656  {
657  const bool isDeg = ui.checkBoxUseDegree->isChecked();
658  const auto factor =
660  const float conversionFactor = isDeg ? 180.0 / M_PI : 1.0f;
661  const float pos = currentNode->getJointValue() * conversionFactor;
662 
663  ui.lcdNumberKinematicUnitJointValue->display((int)pos);
664  ui.horizontalSliderKinematicUnitPos->setSliderPosition((int)(pos * factor));
665  }
666 
667  if (currentNode->isTranslationalJoint())
668  {
669  const auto factor = SLIDER_POS_DEG_MULTIPLIER;
670  const float pos = currentNode->getJointValue();
671 
672  ui.lcdNumberKinematicUnitJointValue->display((int)pos);
673  ui.horizontalSliderKinematicUnitPos->setSliderPosition((int)(pos * factor));
674  }
675  }
676  }
677  }
678 
679  void
681  {
682  const auto selectedControlMode = getSelectedControlMode();
683 
684  if (selectedControlMode == eVelocityControl || selectedControlMode == eTorqueControl)
685  {
686  ui.horizontalSliderKinematicUnitPos->setSliderPosition(SLIDER_ZERO_POSITION);
687  ui.lcdNumberKinematicUnitJointValue->display(SLIDER_ZERO_POSITION);
688  }
689  }
690 
691  void
693  {
694  ARMARX_VERBOSE << "Setting control mode of radio button group to " << controlMode;
695 
696  switch (controlMode)
697  {
698  case eDisabled:
699  case eUnknown:
700  case ePositionVelocityControl:
701  ui.radioButtonUnknown->setChecked(true);
702  break;
703  case ePositionControl:
704  ui.radioButtonPositionControl->setChecked(true);
705  break;
706  case eVelocityControl:
707  ui.radioButtonVelocityControl->setChecked(true);
708  break;
709  case eTorqueControl:
710  ui.radioButtonTorqueControl->setChecked(true);
711  break;
712  }
713  }
714 
715  void
717  {
718  if (!ui.radioButtonPositionControl->isChecked())
719  {
720  return;
721  }
722  NameControlModeMap jointModes;
723  // selectedControlMode = ePositionControl;
724  ui.widgetSliderFactor->setVisible(false);
725 
726  // FIXME currentNode should be passed to this function!
727 
728  if (currentNode)
729  {
730  const QString unit = [&]() -> QString
731  {
732  if (currentNode->isRotationalJoint() or currentNode->isHemisphereJoint() or
733  currentNode->isFourBarJoint())
734  {
735  if (ui.checkBoxUseDegree->isChecked())
736  {
737  return "deg";
738  }
739 
740  return "rad";
741  }
742 
743  if (currentNode->isTranslationalJoint())
744  {
745  return "mm";
746  }
747 
748  throw std::invalid_argument("unknown/unsupported joint type");
749  }();
750 
751  ui.labelUnit->setText(unit);
752 
753 
754  const auto [factor, conversionFactor] = [&]() -> std::pair<float, float>
755  {
756  if (currentNode->isRotationalJoint() or currentNode->isHemisphereJoint() or
757  currentNode->isFourBarJoint())
758  {
759  const bool isDeg = ui.checkBoxUseDegree->isChecked();
760  if (isDeg)
761  {
762  return {SLIDER_POS_DEG_MULTIPLIER, 180.0 / M_PI};
763  }
764  return {SLIDER_POS_RAD_MULTIPLIER, 1};
765  }
766 
767  if (currentNode->isTranslationalJoint())
768  {
769  return {SLIDER_POS_DEG_MULTIPLIER, 1};
770  }
771 
772  throw std::invalid_argument("unknown/unsupported joint type");
773  }();
774 
775  jointModes[currentNode->getName()] = ePositionControl;
776 
778  {
779  kinematicUnitInterfacePrx->switchControlMode(jointModes);
780  }
781 
782  const float lo = currentNode->getJointLimitLo() * conversionFactor;
783  const float hi = currentNode->getJointLimitHi() * conversionFactor;
784 
785  if (hi - lo <= 0.0f)
786  {
787  return;
788  }
789 
790  {
791  // currentNode->getJointValue() can we wrong after we re-connected to the robot unit.
792  // E.g., it can be 0 although the torso joint was at -365 before the unit disconnected.
793  // Therefore, we first have to fetch the actual joint values and use that one.
794  // However, this should actually not be necessary, as the robot model should be updated
795  // via the topics.
797  }
798 
799  const float pos = currentNode->getJointValue() * conversionFactor;
800  ARMARX_INFO << "Setting position control for current node "
801  << "(name '" << currentNode->getName() << "' with current value " << pos
802  << ")";
803 
804  // Setting the slider position to pos will set the position to the slider tick closest to pos
805  // This will initially send a position target with a small delta to the joint.
806  ui.horizontalSliderKinematicUnitPos->blockSignals(true);
807 
808  const float sliderMax = hi * factor;
809  const float sliderMin = lo * factor;
810 
811  ui.horizontalSliderKinematicUnitPos->setMaximum(sliderMax);
812  ui.horizontalSliderKinematicUnitPos->setMinimum(sliderMin);
813 
814  const std::size_t desiredNumberOfTicks = 1'000;
815 
816  const float tickInterval = (sliderMax - sliderMin) / desiredNumberOfTicks;
817  ARMARX_INFO << VAROUT(tickInterval);
818 
819  ui.horizontalSliderKinematicUnitPos->setTickInterval(tickInterval);
820  ui.lcdNumberKinematicUnitJointValue->display(pos);
821 
822  ui.horizontalSliderKinematicUnitPos->blockSignals(false);
823  resetSlider();
824  }
825  }
826 
827  void
828  KinematicUnitWidgetController::setControlModeVelocity()
829  {
830  if (!ui.radioButtonVelocityControl->isChecked())
831  {
832  return;
833  }
834  NameControlModeMap jointModes;
835  NameValueMap jointVelocities;
836 
837  if (currentNode)
838  {
839  jointModes[currentNode->getName()] = eVelocityControl;
840 
841  // set the velocity to zero to stop any previous controller (e.g. torque controller)
842  jointVelocities[currentNode->getName()] = 0;
843 
844 
845  const QString unit = [&]() -> QString
846  {
847  if (currentNode->isRotationalJoint() or currentNode->isHemisphereJoint() or
848  currentNode->isFourBarJoint())
849  {
850  if (ui.checkBoxUseDegree->isChecked())
851  {
852  return "deg/s";
853  }
854 
855  return "rad/(100*s)";
856  }
857 
858  if (currentNode->isTranslationalJoint())
859  {
860  return "mm/s";
861  }
862 
863  throw std::invalid_argument("unknown/unsupported joint type");
864  }();
865 
866 
867  ui.labelUnit->setText(unit);
868  ARMARX_INFO << "setting velocity control for current Node Name: "
869  << currentNode->getName() << flush;
870 
871  const bool isDeg = ui.checkBoxUseDegree->isChecked();
872  const bool isRot = currentNode->isRotationalJoint() or
873  currentNode->isHemisphereJoint() or currentNode->isFourBarJoint();
874 
875  const float lo = isRot ? (isDeg ? -90 : -M_PI * 100) : -1000;
876  const float hi = isRot ? (isDeg ? +90 : +M_PI * 100) : 1000;
877 
878  try
879  {
880  if (kinematicUnitInterfacePrx)
881  {
882  kinematicUnitInterfacePrx->switchControlMode(jointModes);
883  kinematicUnitInterfacePrx->setJointVelocities(jointVelocities);
884  }
885  }
886  catch (...)
887  {
888  }
889 
890  ui.widgetSliderFactor->setVisible(true);
891 
892  ui.horizontalSliderKinematicUnitPos->blockSignals(true);
893  ui.horizontalSliderKinematicUnitPos->setMaximum(hi);
894  ui.horizontalSliderKinematicUnitPos->setMinimum(lo);
895  ui.horizontalSliderKinematicUnitPos->blockSignals(false);
896  resetSlider();
897  }
898  }
899 
900  ControlMode
901  KinematicUnitWidgetController::getSelectedControlMode() const
902  {
903  if (ui.radioButtonPositionControl->isChecked())
904  {
905  return ControlMode::ePositionControl;
906  }
907 
908  if (ui.radioButtonVelocityControl->isChecked())
909  {
910  return ControlMode::eVelocityControl;
911  }
912 
913  if (ui.radioButtonTorqueControl->isChecked())
914  {
915  return ControlMode::eTorqueControl;
916  }
917 
918  // if no button is checked, then the joint is likely initialized but no controller has been loaded yet
919  // (well, the no movement controller should be active)
920  return ControlMode::eUnknown;
921  }
922 
923  void
924  KinematicUnitWidgetController::setControlModeTorque()
925  {
926  if (!ui.radioButtonTorqueControl->isChecked())
927  {
928  return;
929  }
930  NameControlModeMap jointModes;
931 
932  if (currentNode)
933  {
934  jointModes[currentNode->getName()] = eTorqueControl;
935  ui.labelUnit->setText("Ncm");
936  ARMARX_INFO << "setting torque control for current Node Name: "
937  << currentNode->getName() << flush;
938 
939  if (kinematicUnitInterfacePrx)
940  {
941  try
942  {
943  kinematicUnitInterfacePrx->switchControlMode(jointModes);
944  }
945  catch (...)
946  {
947  }
948  }
949 
950  ui.horizontalSliderKinematicUnitPos->blockSignals(true);
951  ui.horizontalSliderKinematicUnitPos->setMaximum(20000.0);
952  ui.horizontalSliderKinematicUnitPos->setMinimum(-20000.0);
953 
954  ui.widgetSliderFactor->setVisible(true);
955 
956  ui.horizontalSliderKinematicUnitPos->blockSignals(false);
957  resetSlider();
958  }
959  }
960 
961  VirtualRobot::RobotPtr
962  KinematicUnitWidgetController::loadRobotFile(std::string fileName)
963  {
964  VirtualRobot::RobotPtr robot;
965 
966  if (verbose)
967  {
968  ARMARX_INFO << "Loading KinematicUnit " << kinematicUnitName << " from "
969  << kinematicUnitFile << " ..." << flush;
970  }
971 
972  if (!ArmarXDataPath::getAbsolutePath(fileName, fileName))
973  {
974  ARMARX_INFO << "Could not find Robot XML file with name " << fileName << flush;
975  }
976 
977  robot = VirtualRobot::RobotIO::loadRobot(fileName);
978 
979  if (!robot)
980  {
981  ARMARX_INFO << "Could not find Robot XML file with name " << fileName << "("
982  << kinematicUnitName << ")" << flush;
983  }
984 
985  return robot;
986  }
987 
988  VirtualRobot::CoinVisualizationPtr
989  KinematicUnitWidgetController::getCoinVisualization(VirtualRobot::RobotPtr robot)
990  {
991  VirtualRobot::CoinVisualizationPtr coinVisualization;
992 
993  if (robot != NULL)
994  {
995  ARMARX_VERBOSE << "getting coin visualization" << flush;
996  coinVisualization = robot->getVisualization<VirtualRobot::CoinVisualization>();
997 
998  if (!coinVisualization || !coinVisualization->getCoinVisualization())
999  {
1000  ARMARX_INFO << "could not get coin visualization" << flush;
1001  }
1002  }
1003 
1004  return coinVisualization;
1005  }
1006 
1007  VirtualRobot::RobotNodeSetPtr
1008  KinematicUnitWidgetController::getRobotNodeSet(VirtualRobot::RobotPtr robot,
1009  std::string nodeSetName)
1010  {
1011  VirtualRobot::RobotNodeSetPtr nodeSetPtr;
1012 
1013  if (robot)
1014  {
1015  nodeSetPtr = robot->getRobotNodeSet(nodeSetName);
1016 
1017  if (!nodeSetPtr)
1018  {
1019  ARMARX_INFO << "RobotNodeSet with name " << nodeSetName << " is not defined"
1020  << flush;
1021  }
1022  }
1023 
1024  return nodeSetPtr;
1025  }
1026 
1027  bool
1028  KinematicUnitWidgetController::initGUIComboBox(VirtualRobot::RobotNodeSetPtr robotNodeSet)
1029  {
1030  ui.nodeListComboBox->clear();
1031 
1032  if (robotNodeSet)
1033  {
1034  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1035 
1036  for (unsigned int i = 0; i < rn.size(); i++)
1037  {
1038  // ARMARX_INFO << "adding item to joint combo box" << rn[i]->getName() << flush;
1039  QString name(rn[i]->getName().c_str());
1040  ui.nodeListComboBox->addItem(name);
1041  }
1042  ui.nodeListComboBox->setCurrentIndex(-1);
1043  return true;
1044  }
1045  return false;
1046  }
1047 
1048  bool
1049  KinematicUnitWidgetController::initGUIJointListTable(VirtualRobot::RobotNodeSetPtr robotNodeSet)
1050  {
1051  uint numberOfColumns = 10;
1052 
1053  //dont use clear! It is not required here and somehow causes the tabel to have
1054  //numberOfColumns additional empty columns and rn.size() additional empty rows.
1055  //Somehow columncount (rowcount) stay at numberOfColumns (rn.size())
1056  //ui.tableJointList->clear();
1057 
1058  if (robotNodeSet)
1059  {
1060  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1061 
1062  //set dimension of table
1063  //ui.tableJointList->setColumnWidth(0,110);
1064 
1065  //ui.tableJointList->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
1066  ui.tableJointList->setRowCount(rn.size());
1067  ui.tableJointList->setColumnCount(eTabelColumnCount);
1068 
1069 
1070  //ui.tableJointList->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
1071 
1072  // set table header
1073  // if the order is changed dont forget to update the order in the enum JointTabelColumnIndex
1074  // in theheader file
1075  QStringList s;
1076  s << "Joint Name"
1077  << "Control Mode"
1078  << "Angle [deg]/Position [mm]"
1079  << "Velocity [deg/s]/[mm/s]"
1080  << "Torque [Nm] / PWM"
1081  << "Current [A]"
1082  << "Temperature [C]"
1083  << "Operation"
1084  << "Error"
1085  << "Enabled"
1086  << "Emergency Stop";
1087  ui.tableJointList->setHorizontalHeaderLabels(s);
1088  ARMARX_CHECK_EXPRESSION(ui.tableJointList->columnCount() == eTabelColumnCount)
1089  << "Current table size: " << ui.tableJointList->columnCount();
1090 
1091 
1092  // fill in joint names
1093  for (unsigned int i = 0; i < rn.size(); i++)
1094  {
1095  // ARMARX_INFO << "adding item to joint table" << rn[i]->getName() << flush;
1096  QString name(rn[i]->getName().c_str());
1097 
1098  QTableWidgetItem* newItem = new QTableWidgetItem(name);
1099  ui.tableJointList->setItem(i, eTabelColumnName, newItem);
1100  }
1101 
1102  // init missing table fields with default values
1103  for (unsigned int i = 0; i < rn.size(); i++)
1104  {
1105  for (unsigned int j = 1; j < numberOfColumns; j++)
1106  {
1107  QString state = "--";
1108  QTableWidgetItem* newItem = new QTableWidgetItem(state);
1109  ui.tableJointList->setItem(i, j, newItem);
1110  }
1111  }
1112 
1113  //hide columns Operation, Error, Enabled and Emergency Stop
1114  //they will be shown when changes occur
1115  ui.tableJointList->setColumnHidden(eTabelColumnTemperature, true);
1116  ui.tableJointList->setColumnHidden(eTabelColumnOperation, true);
1117  ui.tableJointList->setColumnHidden(eTabelColumnError, true);
1118  ui.tableJointList->setColumnHidden(eTabelColumnEnabled, true);
1119  ui.tableJointList->setColumnHidden(eTabelColumnEmergencyStop, true);
1120 
1121  return true;
1122  }
1123 
1124  return false;
1125  }
1126 
1127  void
1128  KinematicUnitWidgetController::selectJoint(int i)
1129  {
1130  std::unique_lock lock(mutexNodeSet);
1131 
1132  ARMARX_INFO << "Selected index: " << ui.nodeListComboBox->currentIndex();
1133 
1134  if (!robotNodeSet || i < 0 || i >= static_cast<int>(robotNodeSet->getSize()))
1135  {
1136  return;
1137  }
1138 
1139  currentNode = robotNodeSet->getAllRobotNodes()[i];
1140  ARMARX_IMPORTANT << "Selected joint is `" << currentNode->getName() << "`.";
1141 
1142  const auto controlModes = kinematicUnitInterfacePrx->getControlModes();
1143  if (controlModes.count(currentNode->getName()) == 0)
1144  {
1145  ARMARX_ERROR << "Could not retrieve control mode for joint `" << currentNode->getName()
1146  << "` from kinematic unit!";
1147  return;
1148  }
1149 
1150  const auto controlMode = controlModes.at(currentNode->getName());
1151  setControlModeRadioButtonGroup(controlMode);
1152 
1153  if (controlMode == ePositionControl)
1154  {
1155  setControlModePosition();
1156  }
1157  else if (controlMode == eVelocityControl)
1158  {
1159  setControlModeVelocity();
1160  ui.horizontalSliderKinematicUnitPos->setSliderPosition(SLIDER_ZERO_POSITION);
1161  }
1162  else if (controlMode == eTorqueControl)
1163  {
1164  setControlModeTorque();
1165  ui.horizontalSliderKinematicUnitPos->setSliderPosition(SLIDER_ZERO_POSITION);
1166  }
1167  }
1168 
1169  void
1170  KinematicUnitWidgetController::selectJointFromTableWidget(int row, int column)
1171  {
1172  if (column == eTabelColumnName)
1173  {
1174  ui.nodeListComboBox->setCurrentIndex(row);
1175  // selectJoint(row);
1176  }
1177  }
1178 
1179  void
1180  KinematicUnitWidgetController::sliderValueChanged(int pos)
1181  {
1182  std::unique_lock lock(mutexNodeSet);
1183 
1184  if (!currentNode)
1185  {
1186  return;
1187  }
1188 
1189  const float value = static_cast<float>(ui.horizontalSliderKinematicUnitPos->value());
1190 
1191  const ControlMode currentControlMode = getSelectedControlMode();
1192 
1193  const bool isDeg = ui.checkBoxUseDegree->isChecked();
1194  const bool isRot = currentNode->isRotationalJoint() or currentNode->isHemisphereJoint() or
1195  currentNode->isFourBarJoint();
1196 
1197  if (currentControlMode == ePositionControl)
1198  {
1199  const auto factor =
1200  isRot && !isDeg ? SLIDER_POS_RAD_MULTIPLIER : SLIDER_POS_DEG_MULTIPLIER;
1201  float conversionFactor = isRot && isDeg ? 180.0 / M_PI : 1.0f;
1202 
1203  NameValueMap jointAngles;
1204 
1205  jointAngles[currentNode->getName()] = value / conversionFactor / factor;
1206  ui.lcdNumberKinematicUnitJointValue->display(value / factor);
1207  if (kinematicUnitInterfacePrx)
1208  {
1209  try
1210  {
1211  kinematicUnitInterfacePrx->setJointAngles(jointAngles);
1212  }
1213  catch (...)
1214  {
1215  }
1216  }
1217  }
1218  else if (currentControlMode == eVelocityControl)
1219  {
1220  float conversionFactor = isRot ? (isDeg ? 180.0 / M_PI : 100.f) : 1.0f;
1221  NameValueMap jointVelocities;
1222  jointVelocities[currentNode->getName()] =
1223  value / conversionFactor *
1224  static_cast<float>(ui.doubleSpinBoxKinematicUnitPosFactor->value());
1225  ui.lcdNumberKinematicUnitJointValue->display(value);
1226 
1227  if (kinematicUnitInterfacePrx)
1228  {
1229  try
1230  {
1231  kinematicUnitInterfacePrx->setJointVelocities(jointVelocities);
1232  }
1233  catch (...)
1234  {
1235  }
1236  }
1237  }
1238  else if (currentControlMode == eTorqueControl)
1239  {
1240  NameValueMap jointTorques;
1241  float torqueTargetValue =
1242  value / 100.0f *
1243  static_cast<float>(ui.doubleSpinBoxKinematicUnitPosFactor->value());
1244  jointTorques[currentNode->getName()] = torqueTargetValue;
1245  ui.lcdNumberKinematicUnitJointValue->display(torqueTargetValue);
1246 
1247  if (kinematicUnitInterfacePrx)
1248  {
1249  try
1250  {
1251  kinematicUnitInterfacePrx->setJointTorques(jointTorques);
1252  }
1253  catch (...)
1254  {
1255  }
1256  }
1257  }
1258  else
1259  {
1260  ARMARX_INFO << "current ControlModes unknown" << flush;
1261  }
1262  }
1263 
1264  void
1265  KinematicUnitWidgetController::updateControlModesTable(
1266  const NameControlModeMap& reportedJointControlModes)
1267  {
1268  if (!getWidget() || !robotNodeSet)
1269  {
1270  return;
1271  }
1272 
1273  std::unique_lock lock(mutexNodeSet);
1274  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1275 
1276  for (unsigned int i = 0; i < rn.size(); i++)
1277  {
1278  NameControlModeMap::const_iterator it;
1279  it = reportedJointControlModes.find(rn[i]->getName());
1280  QString state;
1281 
1282  if (it == reportedJointControlModes.end())
1283  {
1284  state = "unknown";
1285  }
1286  else
1287  {
1288  ControlMode currentMode = it->second;
1289 
1290 
1291  switch (currentMode)
1292  {
1293  /*case eNoMode:
1294  state = "None";
1295  break;
1296 
1297  case eUnknownMode:
1298  state = "Unknown";
1299  break;
1300  */
1301  case eDisabled:
1302  state = "Disabled";
1303  break;
1304 
1305  case eUnknown:
1306  state = "Unknown";
1307  break;
1308 
1309  case ePositionControl:
1310  state = "Position";
1311  break;
1312 
1313  case eVelocityControl:
1314  state = "Velocity";
1315  break;
1316 
1317  case eTorqueControl:
1318  state = "Torque";
1319  break;
1320 
1321 
1322  case ePositionVelocityControl:
1323  state = "Position + Velocity";
1324  break;
1325 
1326  default:
1327  //show the value of the mode so it can be implemented
1328  state = QString("<nyi Mode: %1>").arg(static_cast<int>(currentMode));
1329  break;
1330  }
1331  }
1332 
1333  QTableWidgetItem* newItem = new QTableWidgetItem(state);
1334  ui.tableJointList->setItem(i, eTabelColumnControlMode, newItem);
1335  }
1336  }
1337 
1338  void
1339  KinematicUnitWidgetController::updateJointStatusesTable(
1340  const NameStatusMap& reportedJointStatuses)
1341  {
1342  if (!getWidget() || !robotNodeSet || reportedJointStatuses.empty())
1343  {
1344  return;
1345  }
1346 
1347  std::unique_lock lock(mutexNodeSet);
1348  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1349 
1350  for (unsigned int i = 0; i < rn.size(); i++)
1351  {
1352 
1353  auto it = reportedJointStatuses.find(rn[i]->getName());
1354  if (it == reportedJointStatuses.end())
1355  {
1356  ARMARX_VERBOSE << deactivateSpam(5, rn[i]->getName()) << "Joint Status for "
1357  << rn[i]->getName() << " was not reported!";
1358  continue;
1359  }
1360  JointStatus currentStatus = it->second;
1361 
1362  QString state = translateStatus(currentStatus.operation);
1363  QTableWidgetItem* newItem = new QTableWidgetItem(state);
1364  ui.tableJointList->setItem(i, eTabelColumnOperation, newItem);
1365 
1366  state = translateStatus(currentStatus.error);
1367  newItem = new QTableWidgetItem(state);
1368  ui.tableJointList->setItem(i, eTabelColumnError, newItem);
1369 
1370  state = currentStatus.enabled ? "yes" : "no";
1371  newItem = new QTableWidgetItem(state);
1372  ui.tableJointList->setItem(i, eTabelColumnEnabled, newItem);
1373 
1374  state = currentStatus.emergencyStop ? "yes" : "no";
1375  newItem = new QTableWidgetItem(state);
1376  ui.tableJointList->setItem(i, eTabelColumnEmergencyStop, newItem);
1377  }
1378 
1379  //show columns
1380  ui.tableJointList->setColumnHidden(eTabelColumnOperation, false);
1381  ui.tableJointList->setColumnHidden(eTabelColumnError, false);
1382  ui.tableJointList->setColumnHidden(eTabelColumnEnabled, false);
1383  ui.tableJointList->setColumnHidden(eTabelColumnEmergencyStop, false);
1384  }
1385 
1386  QString
1387  KinematicUnitWidgetController::translateStatus(OperationStatus status)
1388  {
1389  switch (status)
1390  {
1391  case eOffline:
1392  return "Offline";
1393 
1394  case eOnline:
1395  return "Online";
1396 
1397  case eInitialized:
1398  return "Initialized";
1399 
1400  default:
1401  return "?";
1402  }
1403  }
1404 
1405  QString
1406  KinematicUnitWidgetController::translateStatus(ErrorStatus status)
1407  {
1408  switch (status)
1409  {
1410  case eOk:
1411  return "Ok";
1412 
1413  case eWarning:
1414  return "Wr";
1415 
1416  case eError:
1417  return "Er";
1418 
1419  default:
1420  return "?";
1421  }
1422  }
1423 
1424  void
1425  KinematicUnitWidgetController::updateJointAnglesTable(const NameValueMap& reportedJointAngles)
1426  {
1427  std::unique_lock lock(mutexNodeSet);
1428 
1429  if (!robotNodeSet)
1430  {
1431  return;
1432  }
1433  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1434 
1435 
1436  for (unsigned int i = 0; i < rn.size(); i++)
1437  {
1438  NameValueMap::const_iterator it;
1439  VirtualRobot::RobotNodePtr node = rn[i];
1440  it = reportedJointAngles.find(node->getName());
1441 
1442  if (it == reportedJointAngles.end())
1443  {
1444  continue;
1445  }
1446 
1447  const float currentValue = it->second;
1448 
1449  QModelIndex index = ui.tableJointList->model()->index(i, eTabelColumnAngleProgressbar);
1450  float conversionFactor = ui.checkBoxUseDegree->isChecked() &&
1451  (node->isRotationalJoint() or
1452  node->isHemisphereJoint() or node->isFourBarJoint())
1453  ? 180.0 / M_PI
1454  : 1;
1455  ui.tableJointList->model()->setData(
1456  index,
1457  (int)(cutJitter(currentValue * conversionFactor) * 100) / 100.0f,
1458  eJointAngleRole);
1459  ui.tableJointList->model()->setData(
1460  index, node->getJointLimitHigh() * conversionFactor, eJointHiRole);
1461  ui.tableJointList->model()->setData(
1462  index, node->getJointLimitLow() * conversionFactor, eJointLoRole);
1463  }
1464  }
1465 
1466  void
1467  KinematicUnitWidgetController::updateJointVelocitiesTable(
1468  const NameValueMap& reportedJointVelocities)
1469  {
1470  if (!getWidget())
1471  {
1472  return;
1473  }
1474 
1475  std::unique_lock lock(mutexNodeSet);
1476  if (!robotNodeSet)
1477  {
1478  return;
1479  }
1480  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1481  QTableWidgetItem* newItem;
1482 
1483  for (unsigned int i = 0; i < rn.size(); i++)
1484  {
1485  NameValueMap::const_iterator it;
1486  it = reportedJointVelocities.find(rn[i]->getName());
1487 
1488  if (it == reportedJointVelocities.end())
1489  {
1490  continue;
1491  }
1492 
1493  float currentValue = it->second;
1494  if (ui.checkBoxUseDegree->isChecked() &&
1495  (rn[i]->isRotationalJoint() or rn[i]->isHemisphereJoint() or
1496  rn[i]->isFourBarJoint()))
1497  {
1498  currentValue *= 180.0 / M_PI;
1499  }
1500  const QString Text = QString::number(cutJitter(currentValue), 'g', 2);
1501  newItem = new QTableWidgetItem(Text);
1502  ui.tableJointList->setItem(i, eTabelColumnVelocity, newItem);
1503  }
1504  }
1505 
1506  void
1507  KinematicUnitWidgetController::updateJointTorquesTable(const NameValueMap& reportedJointTorques)
1508  {
1509 
1510 
1511  std::unique_lock lock(mutexNodeSet);
1512  if (!getWidget() || !robotNodeSet)
1513  {
1514  return;
1515  }
1516  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1517  QTableWidgetItem* newItem;
1518  NameValueMap::const_iterator it;
1519 
1520  for (unsigned int i = 0; i < rn.size(); i++)
1521  {
1522  it = reportedJointTorques.find(rn[i]->getName());
1523 
1524  if (it == reportedJointTorques.end())
1525  {
1526  continue;
1527  }
1528 
1529  const float currentValue = it->second;
1530  newItem = new QTableWidgetItem(QString::number(cutJitter(currentValue)));
1531  ui.tableJointList->setItem(i, eTabelColumnTorque, newItem);
1532  }
1533  }
1534 
1535  void
1536  KinematicUnitWidgetController::updateJointCurrentsTable(
1537  const NameValueMap& reportedJointCurrents,
1538  const NameStatusMap& reportedJointStatuses)
1539  {
1540 
1541 
1542  std::unique_lock lock(mutexNodeSet);
1543  if (!getWidget() || !robotNodeSet || jointCurrentHistory.size() == 0)
1544  {
1545  return;
1546  }
1547  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1548  QTableWidgetItem* newItem;
1549 
1550  // FIXME history!
1551  // NameValueMap reportedJointCurrents = jointCurrentHistory.back().second;
1552  NameValueMap::const_iterator it;
1553 
1554  for (unsigned int i = 0; i < rn.size(); i++)
1555  {
1556  it = reportedJointCurrents.find(rn[i]->getName());
1557 
1558  if (it == reportedJointCurrents.end())
1559  {
1560  continue;
1561  }
1562 
1563  const float currentValue = it->second;
1564  newItem = new QTableWidgetItem(QString::number(cutJitter(currentValue)));
1565  ui.tableJointList->setItem(i, eTabelColumnCurrent, newItem);
1566  }
1567 
1568  highlightCriticalValues(reportedJointStatuses);
1569  }
1570 
1571  void
1572  KinematicUnitWidgetController::updateMotorTemperaturesTable(
1573  const NameValueMap& reportedJointTemperatures)
1574  {
1575 
1576 
1577  std::unique_lock lock(mutexNodeSet);
1578  if (!getWidget() || !robotNodeSet || reportedJointTemperatures.empty())
1579  {
1580  return;
1581  }
1582  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1583  QTableWidgetItem* newItem;
1584  NameValueMap::const_iterator it;
1585 
1586  for (unsigned int i = 0; i < rn.size(); i++)
1587  {
1588  it = reportedJointTemperatures.find(rn[i]->getName());
1589 
1590  if (it == reportedJointTemperatures.end())
1591  {
1592  continue;
1593  }
1594 
1595  const float currentValue = it->second;
1596  newItem = new QTableWidgetItem(QString::number(cutJitter(currentValue)));
1597  ui.tableJointList->setItem(i, eTabelColumnTemperature, newItem);
1598  }
1599  ui.tableJointList->setColumnHidden(eTabelColumnTemperature, false);
1600  }
1601 
1602  void
1603  KinematicUnitWidgetController::updateModel(const NameValueMap& reportedJointAngles)
1604  {
1605  // ARMARX_INFO << "updateModel()" << flush;
1606  std::unique_lock lock(mutexNodeSet);
1607  if (!robotNodeSet)
1608  {
1609  return;
1610  }
1611  robot->setJointValues(reportedJointAngles);
1612  }
1613 
1614  std::optional<float>
1615  mean(const boost::circular_buffer<NameValueMap>& buffer, const std::string& key)
1616  {
1617  float sum = 0;
1618  std::size_t count = 0;
1619 
1620  for (const auto& element : buffer)
1621  {
1622  if (element.count(key) > 0)
1623  {
1624  sum += element.at(key);
1625  }
1626  }
1627 
1628  if (count == 0)
1629  {
1630  return std::nullopt;
1631  }
1632 
1633  return sum / static_cast<float>(count);
1634  }
1635 
1636  void
1637  KinematicUnitWidgetController::highlightCriticalValues(
1638  const NameStatusMap& reportedJointStatuses)
1639  {
1640  if (!enableValueValidator)
1641  {
1642  return;
1643  }
1644 
1645  std::unique_lock lock(mutexNodeSet);
1646 
1647  std::vector<VirtualRobot::RobotNodePtr> rn = robotNodeSet->getAllRobotNodes();
1648 
1649  // get standard line colors
1650  static std::vector<QBrush> standardColors;
1651  if (standardColors.size() == 0)
1652  {
1653  for (unsigned int i = 0; i < rn.size(); i++)
1654  {
1655  // all cells of a row have the same color
1656  standardColors.push_back(
1657  ui.tableJointList->item(i, eTabelColumnCurrent)->background());
1658  }
1659  }
1660 
1661  // check robot current value of nodes
1662  for (unsigned int i = 0; i < rn.size(); i++)
1663  {
1664  const auto& jointName = rn[i]->getName();
1665 
1666  const auto currentSmoothValOpt = mean(jointCurrentHistory, jointName);
1667  if (not currentSmoothValOpt.has_value())
1668  {
1669  continue;
1670  }
1671 
1672  const float smoothValue = std::fabs(currentSmoothValOpt.value());
1673 
1674  if (jointCurrentHistory.front().count(jointName) == 0)
1675  {
1676  continue;
1677  }
1678 
1679  const float startValue = jointCurrentHistory.front().at(jointName);
1680  const bool isStatic = (smoothValue == startValue);
1681 
1682  NameStatusMap::const_iterator it;
1683  it = reportedJointStatuses.find(rn[i]->getName());
1684  JointStatus currentStatus = it->second;
1685 
1686  if (isStatic)
1687  {
1688  if (currentStatus.operation != eOffline)
1689  {
1690  // current value is zero, but joint is not offline
1691  ui.tableJointList->item(i, eTabelColumnCurrent)->setBackground(Qt::yellow);
1692  }
1693  }
1694  else if (std::abs(smoothValue) > currentValueMax)
1695  {
1696  // current value is too high
1697  ui.tableJointList->item(i, eTabelColumnCurrent)->setBackground(Qt::red);
1698  }
1699  else
1700  {
1701  // everything seems to work as expected
1702  ui.tableJointList->item(i, eTabelColumnCurrent)->setBackground(standardColors[i]);
1703  }
1704  }
1705  }
1706 
1707  void
1708  KinematicUnitWidgetController::setMutex3D(RecursiveMutexPtr const& mutex3D)
1709  {
1710  this->mutex3D = mutex3D;
1711 
1712  if (debugDrawer)
1713  {
1714  debugDrawer->setMutex(mutex3D);
1715  }
1716  }
1717 
1718  QPointer<QWidget>
1719  KinematicUnitWidgetController::getCustomTitlebarWidget(QWidget* parent)
1720  {
1721  if (customToolbar)
1722  {
1723  customToolbar->setParent(parent);
1724  }
1725  else
1726  {
1727  customToolbar = new QToolBar(parent);
1728  customToolbar->addAction("ZeroVelocity", this, SLOT(kinematicUnitZeroVelocity()));
1729  }
1730  return customToolbar.data();
1731  }
1732 
1733  float
1734  KinematicUnitWidgetController::cutJitter(float value)
1735  {
1736  return (abs(value) < static_cast<float>(ui.jitterThresholdSpinBox->value())) ? 0 : value;
1737  }
1738 
1739  void
1740  KinematicUnitWidgetController::fetchData()
1741  {
1742  ARMARX_DEBUG << "updateGui";
1743 
1744  if (not kinematicUnitInterfacePrx)
1745  {
1746  ARMARX_WARNING << "KinematicUnit is not available!";
1747  return;
1748  }
1749 
1750  const auto debugInfo = kinematicUnitInterfacePrx->getDebugInfo();
1751 
1752  emit onDebugInfoReceived(debugInfo);
1753  }
1754 
1755  void
1756  KinematicUnitWidgetController::debugInfoReceived(const DebugInfo& debugInfo)
1757  {
1758  ARMARX_DEBUG << "debug info received";
1759 
1760  updateModel(debugInfo.jointAngles);
1761 
1762  updateJointAnglesTable(debugInfo.jointAngles);
1763  updateJointVelocitiesTable(debugInfo.jointVelocities);
1764  updateJointTorquesTable(debugInfo.jointTorques);
1765  updateJointCurrentsTable(debugInfo.jointCurrents, debugInfo.jointStatus);
1766  updateControlModesTable(debugInfo.jointModes);
1767  updateJointStatusesTable(debugInfo.jointStatus);
1768  updateMotorTemperaturesTable(debugInfo.jointMotorTemperatures);
1769  }
1770 
1771  void
1772  RangeValueDelegate::paint(QPainter* painter,
1773  const QStyleOptionViewItem& option,
1774  const QModelIndex& index) const
1775  {
1776  if (index.column() == KinematicUnitWidgetController::eTabelColumnAngleProgressbar)
1777  {
1778  float jointValue = index.data(KinematicUnitWidgetController::eJointAngleRole).toFloat();
1779  float loDeg = index.data(KinematicUnitWidgetController::eJointLoRole).toFloat();
1780  float hiDeg = index.data(KinematicUnitWidgetController::eJointHiRole).toFloat();
1781 
1782  if (hiDeg - loDeg <= 0)
1783  {
1784  QStyledItemDelegate::paint(painter, option, index);
1785  return;
1786  }
1787 
1788  QStyleOptionProgressBar progressBarOption;
1789  progressBarOption.rect = option.rect;
1790  progressBarOption.minimum = loDeg;
1791  progressBarOption.maximum = hiDeg;
1792  progressBarOption.progress = jointValue;
1793  progressBarOption.text = QString::number(jointValue);
1794  progressBarOption.textVisible = true;
1795  QPalette pal;
1796  pal.setColor(QPalette::Background, Qt::red);
1797  progressBarOption.palette = pal;
1798  QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
1799  }
1800  else
1801  {
1802  QStyledItemDelegate::paint(painter, option, index);
1803  }
1804  }
1805 
1806  KinematicUnitWidgetController::~KinematicUnitWidgetController()
1807  {
1808  kinematicUnitInterfacePrx = nullptr;
1809 
1810  if (updateTask)
1811  {
1812  updateTask->stop();
1813  updateTask->join();
1814  updateTask = nullptr;
1815  }
1816  }
1817 
1818  void
1819  KinematicUnitWidgetController::on_pushButtonFromJson_clicked()
1820  {
1821  bool ok;
1822  const auto text = QInputDialog::getMultiLineText(
1823  __widget, tr("JSON Joint values"), tr("Json:"), "{\n}", &ok)
1824  .toStdString();
1825 
1826  if (!ok || text.empty())
1827  {
1828  return;
1829  }
1830 
1831  NameValueMap jointAngles;
1832  try
1833  {
1834  jointAngles = simox::json::json2NameValueMap(text);
1835  }
1836  catch (...)
1837  {
1838  ARMARX_ERROR << "invalid json";
1839  }
1840 
1841  NameControlModeMap jointModes;
1842  for (const auto& [key, _] : jointAngles)
1843  {
1844  jointModes[key] = ePositionControl;
1845  }
1846 
1847  try
1848  {
1849  kinematicUnitInterfacePrx->switchControlMode(jointModes);
1850  kinematicUnitInterfacePrx->setJointAngles(jointAngles);
1851  }
1852  catch (...)
1853  {
1854  ARMARX_ERROR << "failed to switch mode or set angles";
1855  }
1856  }
1857 
1858  void
1859  KinematicUnitWidgetController::synchronizeRobotJointAngles()
1860  {
1861  const NameValueMap currentJointAngles = kinematicUnitInterfacePrx->getJointAngles();
1862  robot->setJointValues(currentJointAngles);
1863  }
1864 
1865 } // namespace armarx
armarx::ArmarXWidgetController::mutex3D
std::shared_ptr< std::recursive_mutex > mutex3D
Definition: ArmarXWidgetController.h:301
armarx::KinematicUnitWidgetController::updateKinematicUnitListInDialog
void updateKinematicUnitListInDialog()
Definition: KinematicUnitGuiPlugin.cpp:472
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::KinematicUnitWidgetController::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: KinematicUnitGuiPlugin.cpp:120
armarx::KinematicUnitWidgetController::ui
Ui::KinematicUnitGuiPlugin ui
Definition: KinematicUnitGuiPlugin.h:239
armarx::KinematicUnitWidgetController::updateGuiElements
void updateGuiElements()
Definition: KinematicUnitGuiPlugin.cpp:466
algorithm.h
armarx::Application::GetProjectName
static const std::string & GetProjectName()
Definition: Application.cpp:861
armarx::KinematicUnitWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: KinematicUnitGuiPlugin.cpp:383
armarx::KinematicUnitWidgetController::jointTorquesReported
void jointTorquesReported()
armarx::KinematicUnitWidgetController::updateTask
armarx::RunningTask< KinematicUnitWidgetController >::pointer_type updateTask
Definition: KinematicUnitGuiPlugin.h:321
JSONObject.h
armarx::KinematicUnitWidgetController::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: KinematicUnitGuiPlugin.cpp:167
armarx::KinematicUnitWidgetController::jointStatusesReported
void jointStatusesReported()
ArmarXManager.h
armarx::KinematicUnitWidgetController::kinematicUnitZeroVelocity
void kinematicUnitZeroVelocity()
Definition: KinematicUnitGuiPlugin.cpp:607
SLIDER_POS_DEG_MULTIPLIER
constexpr float SLIDER_POS_DEG_MULTIPLIER
Definition: KinematicUnitGuiPlugin.cpp:86
armarx::KinematicUnitWidgetController::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: KinematicUnitGuiPlugin.cpp:394
armarx::KinematicUnitWidgetController::rootVisu
SoSeparator * rootVisu
Definition: KinematicUnitGuiPlugin.h:259
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::KinematicUnitWidgetController::setControlModeVelocity
void setControlModeVelocity()
Definition: KinematicUnitGuiPlugin.cpp:828
armarx::JSONObject
The JSONObject class is used to represent and (de)serialize JSON objects.
Definition: JSONObject.h:43
armarx::Split
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
Definition: StringHelperTemplates.h:35
armarx::ManagedIceObject::getArmarXManager
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
Definition: ManagedIceObject.cpp:348
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:53
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::KinematicUnitWidgetController::setControlModeRadioButtonGroup
void setControlModeRadioButtonGroup(const ControlMode &controlMode)
Definition: KinematicUnitGuiPlugin.cpp:692
armarx::KinematicUnitWidgetController::robotVisu
SoSeparator * robotVisu
Definition: KinematicUnitGuiPlugin.h:260
armarx::KinematicUnitWidgetController::setControlModePosition
void setControlModePosition()
Definition: KinematicUnitGuiPlugin.cpp:716
armarx::KinematicUnitWidgetController::modelUpdateCB
void modelUpdateCB()
Definition: KinematicUnitGuiPlugin.cpp:477
SLIDER_POS_HEMI_MULTIPLIER
constexpr float SLIDER_POS_HEMI_MULTIPLIER
Definition: KinematicUnitGuiPlugin.cpp:88
armarx::navigation::platform_controller::platform_global_trajectory::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformGlobalTrajectoryController.h:93
lo
#define lo(x)
Definition: AbstractInterface.h:43
RunningTask.h
armarx::KinematicUnitWidgetController::setControlModeTorque
void setControlModeTorque()
Definition: KinematicUnitGuiPlugin.cpp:924
armarx::starts_with
bool starts_with(const std::string &haystack, const std::string &needle)
Definition: StringHelpers.cpp:43
armarx::RunningTask
Definition: ArmarXMultipleObjectsScheduler.h:35
SLIDER_POS_RAD_MULTIPLIER
constexpr float SLIDER_POS_RAD_MULTIPLIER
Definition: KinematicUnitGuiPlugin.cpp:87
project
std::string project
Definition: VisualizationRobot.cpp:83
armarx::KinematicUnitWidgetController::updateControlModesTable
void updateControlModesTable(const NameControlModeMap &reportedJointControlModes)
Definition: KinematicUnitGuiPlugin.cpp:1265
IceInternal::Handle< JSONObject >
armarx::KinematicUnitWidgetController::updateJointCurrentsTable
void updateJointCurrentsTable(const NameValueMap &reportedJointCurrents, const NameStatusMap &reportedJointStatuses)
Definition: KinematicUnitGuiPlugin.cpp:1536
armarx::KinematicUnitWidgetController::KinematicUnitWidgetController
KinematicUnitWidgetController()
Definition: KinematicUnitGuiPlugin.cpp:101
armarx::KinematicUnitWidgetController::resetSliderToZeroPosition
void resetSliderToZeroPosition()
Definition: KinematicUnitGuiPlugin.cpp:680
armarx::KinematicUnitWidgetController::copyToClipboard
void copyToClipboard()
Definition: KinematicUnitGuiPlugin.cpp:433
armarx::KinematicUnitWidgetController::selectJoint
void selectJoint(int i)
Definition: KinematicUnitGuiPlugin.cpp:1128
armarx::KinematicUnitWidgetController::updateJointStatusesTable
void updateJointStatusesTable(const NameStatusMap &reportedJointStatuses)
Definition: KinematicUnitGuiPlugin.cpp:1339
M_PI
#define M_PI
Definition: MathTools.h:17
armarx::KinematicUnitWidgetController::fetchData
void fetchData()
Definition: KinematicUnitGuiPlugin.cpp:1740
armarx::KinematicUnitWidgetController::synchronizeRobotJointAngles
void synchronizeRobotJointAngles()
Definition: KinematicUnitGuiPlugin.cpp:1859
armarx::KinematicUnitWidgetController::eTabelColumnAngleProgressbar
@ eTabelColumnAngleProgressbar
Definition: KinematicUnitGuiPlugin.h:130
armarx::KinematicUnitWidgetController::showVisuLayers
void showVisuLayers(bool show)
Definition: KinematicUnitGuiPlugin.cpp:417
armarx::KinematicUnitWidgetController::on_pushButtonFromJson_clicked
void on_pushButtonFromJson_clicked()
Definition: KinematicUnitGuiPlugin.cpp:1819
armarx::KinematicUnitWidgetController::connectSlots
void connectSlots()
Definition: KinematicUnitGuiPlugin.cpp:497
armarx::KinematicUnitWidgetController::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: KinematicUnitGuiPlugin.cpp:322
armarx::flush
const LogSender::manipulator flush
Definition: LogSender.h:251
armarx::KinematicUnitConfigDialog
Definition: KinematicUnitConfigDialog.h:40
armarx::KinematicUnitWidgetController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: KinematicUnitGuiPlugin.cpp:293
armarx::KinematicUnitWidgetController::currentNode
VirtualRobot::RobotNodePtr currentNode
Definition: KinematicUnitGuiPlugin.h:255
armarx::KinematicUnitWidgetController::selectJointFromTableWidget
void selectJointFromTableWidget(int row, int column)
Definition: KinematicUnitGuiPlugin.cpp:1170
ArmarXObjectScheduler.h
Metronome.h
KinematicUnitConfigDialog.h
armarx::KinematicUnitWidgetController::jointCurrentsReported
void jointCurrentsReported()
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
forward_declarations.h
armarx::KinematicUnitWidgetController::initializeUi
void initializeUi(const DebugInfo &debugInfo)
Definition: KinematicUnitGuiPlugin.cpp:594
armarx::KinematicUnitWidgetController::onDebugInfoReceived
void onDebugInfoReceived(const DebugInfo &debugInfo)
ExpressionException.h
armarx::core::time::Metronome::waitForNextTick
Duration waitForNextTick()
Wait and block until the target period is met.
Definition: Metronome.cpp:31
armarx::KinematicUnitWidgetController::robot
VirtualRobot::RobotPtr robot
Definition: KinematicUnitGuiPlugin.h:253
CMakePackageFinder.h
armarx::KinematicUnitWidgetController::updateJointVelocitiesTable
void updateJointVelocitiesTable(const NameValueMap &reportedJointVelocities)
Definition: KinematicUnitGuiPlugin.cpp:1467
armarx::KinematicUnitWidgetController::jointAnglesReported
void jointAnglesReported()
armarx::KinematicUnitWidgetController::resetSlider
void resetSlider()
Sets the Slider ui.horizontalSliderKinematicUnitPos to 0 if this->selectedControlMode is eVelocityCon...
Definition: KinematicUnitGuiPlugin.cpp:642
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::KinematicUnitWidgetController::debugLayerVisu
SoSeparator * debugLayerVisu
Definition: KinematicUnitGuiPlugin.h:262
armarx::ArmarXWidgetController::enableMainWidgetAsync
void enableMainWidgetAsync(bool enable)
This function enables/disables the main widget asynchronously (if called from a non qt thread).
Definition: ArmarXWidgetController.cpp:174
armarx::KinematicUnitWidgetController::jointVelocitiesReported
void jointVelocitiesReported()
armarx::KinematicUnitWidgetController::verbose
bool verbose
Definition: KinematicUnitGuiPlugin.h:244
armarx::KinematicUnitWidgetController::jointControlModesReported
void jointControlModesReported()
armarx::KinematicUnitGuiPlugin::KinematicUnitGuiPlugin
KinematicUnitGuiPlugin()
Definition: KinematicUnitGuiPlugin.cpp:93
armarx::KinematicUnitWidgetController::kinematicUnitInterfacePrx
KinematicUnitInterfacePrx kinematicUnitInterfacePrx
Definition: KinematicUnitGuiPlugin.h:242
IceUtil::Handle< ArmarXManager >
armarx::core::time::Metronome
Simple rate limiter for use in loops to maintain a certain frequency given a clock.
Definition: Metronome.h:35
MedianFilter.h
armarx::KinematicUnitWidgetController::kinematicUnitNode
SoNode * kinematicUnitNode
Definition: KinematicUnitGuiPlugin.h:258
hi
#define hi(x)
Definition: AbstractInterface.h:42
armarx::KinematicUnitWidgetController::kinematicUnitFile
std::string kinematicUnitFile
Definition: KinematicUnitGuiPlugin.h:246
armarx::KinematicUnitWidgetController::debugDrawer
armarx::DebugDrawerComponentPtr debugDrawer
Definition: KinematicUnitGuiPlugin.h:263
armarx::KinematicUnitWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: KinematicUnitGuiPlugin.cpp:406
armarx::KinematicUnitWidgetController::updateJointAnglesTable
void updateJointAnglesTable(const NameValueMap &reportedJointAngles)
Definition: KinematicUnitGuiPlugin.cpp:1425
armarx::core::time::Clock::Now
static DateTime Now()
Current time on the virtual clock.
Definition: Clock.cpp:97
armarx::KinematicUnitWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: KinematicUnitGuiPlugin.cpp:371
armarx::ArmarXWidgetController::getWidget
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
Definition: ArmarXWidgetController.cpp:54
armarx::ManagedIceObject::getName
std::string getName() const
Retrieve name of object.
Definition: ManagedIceObject.cpp:107
KINEMATIC_UNIT_NAME_DEFAULT
#define KINEMATIC_UNIT_NAME_DEFAULT
Definition: KinematicUnitGuiPlugin.cpp:83
armarx::core::time::Frequency::Hertz
static Frequency Hertz(std::int64_t hertz)
Definition: Frequency.cpp:23
armarx::KinematicUnitWidgetController::runUpdate
void runUpdate()
Definition: KinematicUnitGuiPlugin.cpp:279
armarx::ArmarXDataPath::getAbsolutePath
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
Definition: ArmarXDataPath.cpp:111
armarx::KinematicUnitWidgetController::getScene
SoNode * getScene() override
Reimplementing this function and returning a SoNode* will show this SoNode in the 3DViewerWidget,...
Definition: KinematicUnitGuiPlugin.cpp:482
armarx::PropertyUser::getIceProperties
Ice::PropertiesPtr getIceProperties() const
Returns the set of Ice properties.
Definition: PropertyUser.cpp:229
Logging.h
KinematicUnitGuiPlugin.h
armarx::KinematicUnitWidgetController::kinematicUnitName
std::string kinematicUnitName
Definition: KinematicUnitGuiPlugin.h:248
armarx::KinematicUnitWidgetController::updateMotorTemperaturesTable
void updateMotorTemperaturesTable(const NameValueMap &reportedMotorTemperatures)
Definition: KinematicUnitGuiPlugin.cpp:1572
armarx::KinematicUnitWidgetController::updateJointTorquesTable
void updateJointTorquesTable(const NameValueMap &reportedJointTorques)
Definition: KinematicUnitGuiPlugin.cpp:1507
ArmarXDataPath.h
armarx::KinematicUnitWidgetController::robotNodeSet
VirtualRobot::RobotNodeSetPtr robotNodeSet
Definition: KinematicUnitGuiPlugin.h:254
armarx::KinematicUnitWidgetController::getSelectedControlMode
ControlMode getSelectedControlMode() const
Definition: KinematicUnitGuiPlugin.cpp:901
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:151
armarx::KinematicUnitWidgetController::debugInfoReceived
void debugInfoReceived(const DebugInfo &debugInfo)
Definition: KinematicUnitGuiPlugin.cpp:1756
armarx::KinematicUnitWidgetController::robotNodeSetName
std::string robotNodeSetName
Definition: KinematicUnitGuiPlugin.h:251
armarx::KinematicUnitWidgetController::sliderValueChanged
void sliderValueChanged(int i)
Definition: KinematicUnitGuiPlugin.cpp:1180
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ManagedIceObject::getObjectScheduler
ArmarXObjectSchedulerPtr getObjectScheduler() const
Definition: ManagedIceObject.cpp:731
armarx::KinematicUnitWidgetController::kinematicUnitVisualization
VirtualRobot::CoinVisualizationPtr kinematicUnitVisualization
Definition: KinematicUnitGuiPlugin.h:257
Application.h
armarx::KinematicUnitWidgetController::jointMotorTemperaturesReported
void jointMotorTemperaturesReported()