71 updateInfoTimer->start(50);
74 setLeftHandJointAngleUpdateTask->start();
77 leftHandName = leftHandUnitProxy->getHandName();
79 if (leftHandName ==
"Hand L" || leftHandName ==
"TCP L")
81 leftHandConversionFactor *=
M_PI / 2;
83 else if (leftHandName !=
"Hand_L_EEF")
85 ARMARX_WARNING <<
"Left hand with name \"" << leftHandName <<
"\" is not supported.";
89 SingleTypeVariantListPtr::dynamicCast(leftHandUnitProxy->getShapeNames());
90 QStringList leftHandList;
91 int leftHandPreshapeCount = leftHandPreshapeStrings->getSize();
93 for (
int i = 0; i < leftHandPreshapeCount; ++i)
95 std::string shape = ((leftHandPreshapeStrings->getVariant(i))->
get<std::string>());
97 leftHandList << QString::fromStdString(shape);
100 ui.comboLeftHandPreshapes->clear();
101 ui.comboLeftHandPreshapes->addItems(leftHandList);
103 setRightHandJointAngleUpdateTask->start();
106 rightHandName = rightHandUnitProxy->getHandName();
108 if (rightHandName ==
"Hand R" || rightHandName ==
"TCP R")
110 rightHandConversionFactor *=
M_PI / 2;
112 else if (rightHandName !=
"Hand_R_EEF")
114 ARMARX_WARNING <<
"Right hand with name \"" << rightHandName <<
"\" is not supported.";
118 SingleTypeVariantListPtr::dynamicCast(rightHandUnitProxy->getShapeNames());
119 QStringList rightHandList;
120 int rightHandPreshapeCount = rightHandPreshapeStrings->getSize();
122 for (
int i = 0; i < rightHandPreshapeCount; ++i)
124 std::string shape = ((rightHandPreshapeStrings->getVariant(i))->
get<std::string>());
126 rightHandList << QString::fromStdString(shape);
129 ui.comboRightHandPreshapes->clear();
130 ui.comboRightHandPreshapes->addItems(rightHandList);
134 displayJointAngleUpdateTask =
136 displayJointAngleUpdateTask->start();
216 if (!leftHandUnitProxy)
222 if (!setLeftHandJointAnglesFlag)
227 setLeftHandJointAnglesFlag =
false;
229 NameValueMap leftHandJa;
230 NameValueMap currentLeftHandJointValues = leftHandUnitProxy->getCurrentJointValues();
232 if (leftHandName ==
"Hand L" || leftHandName ==
"TCP L")
234 leftHandConversionFactor *=
M_PI / 2;
236 else if (leftHandName !=
"Hand_L_EEF")
238 ARMARX_WARNING <<
"Left hand with name \"" << leftHandName <<
"\" is not supported.";
242 for (
const auto& pair : currentLeftHandJointValues)
244 if (pair.first == currentLeftHandJoint)
246 value =
static_cast<float>(
ui.horizontalSliderLeftHandJointPos->value() *
247 leftHandConversionFactor);
249 leftHandJa[pair.first] = value;
255 ui.lcdNumberLeftHandJointValue->display(value / leftHandConversionFactor);
256 leftHandUnitProxy->setJointAngles(leftHandJa);
263 if (!rightHandUnitProxy)
269 if (!setRightHandJointAnglesFlag)
274 setRightHandJointAnglesFlag =
false;
276 NameValueMap rightHandJa;
277 NameValueMap currentRightHandJointValues = rightHandUnitProxy->getCurrentJointValues();
279 if (rightHandName ==
"Hand R" || rightHandName ==
"TCP R")
281 rightHandConversionFactor *=
M_PI / 2;
283 else if (rightHandName !=
"Hand_R_EEF")
285 ARMARX_WARNING <<
"Right hand with name \"" << rightHandName <<
"\" is not supported.";
289 for (
const auto& pair : currentRightHandJointValues)
291 if (pair.first == currentRightHandJoint)
293 value =
static_cast<float>(
ui.horizontalSliderRightHandJointPos->value() *
294 rightHandConversionFactor);
296 rightHandJa[pair.first] = value;
302 ui.lcdNumberRightHandJointValue->display(value / rightHandConversionFactor);
303 rightHandUnitProxy->setJointAngles(rightHandJa);
368 NameValueMap currentLeftHandJointValues = leftHandUnitProxy->getCurrentJointValues();
370 int frameLeftHandRowIdx = 0;
372 for (
const auto& pair : currentLeftHandJointValues)
375 QString name(pair.first.c_str());
376 QTableWidgetItem* newItem =
new QTableWidgetItem(QString::number(pair.second));
377 ui.tableWidgetLeftHand->setItem(frameLeftHandRowIdx, 1, newItem);
378 frameLeftHandRowIdx++;
382 NameValueMap currentRightHandJointValues = rightHandUnitProxy->getCurrentJointValues();
384 int frameRightHandRowIdx = 0;
386 for (
const auto& pair : currentRightHandJointValues)
389 QString name(pair.first.c_str());
390 QTableWidgetItem* newItem =
new QTableWidgetItem(QString::number(pair.second));
391 ui.tableWidgetRightHand->setItem(frameRightHandRowIdx, 1, newItem);
392 frameRightHandRowIdx++;
479 NameValueMap currentLeftHandJointValues = leftHandUnitProxy->getCurrentJointValues();
482 for (
const auto& pair : currentLeftHandJointValues)
486 currentLeftHandJoint = pair.first;
487 int convertedValue =
static_cast<int>(pair.second / leftHandConversionFactor);
488 ui.horizontalSliderLeftHandJointPos->setSliderPosition(convertedValue);
489 ui.lcdNumberLeftHandJointValue->display(convertedValue);
501 NameValueMap currentRightHandJointValues = rightHandUnitProxy->getCurrentJointValues();
504 for (
const auto& pair : currentRightHandJointValues)
508 currentRightHandJoint = pair.first;
509 int convertedValue =
static_cast<int>(pair.second / rightHandConversionFactor);
510 ui.horizontalSliderRightHandJointPos->setSliderPosition(convertedValue);
511 ui.lcdNumberRightHandJointValue->display(convertedValue);
536 leftHandUnitProxyName =
537 settings->value(
"leftHandUnitProxyName", QString::fromStdString(leftHandUnitProxyName))
540 leftHandName = settings->value(
"leftHandName", QString::fromStdString(leftHandName))
543 rightHandUnitProxyName =
545 ->value(
"rightHandUnitProxyName", QString::fromStdString(rightHandUnitProxyName))
548 rightHandName = settings->value(
"rightHandName", QString::fromStdString(rightHandName))
568 NameValueMap currentLeftHandJointValues = leftHandUnitProxy->getCurrentJointValues();
570 int frameLeftHandRowIdx = 0;
572 connect(
ui.buttonPreshapeLeftHand,
576 Qt::UniqueConnection);
577 connect(
ui.buttonOpenLeftHand,
581 Qt::UniqueConnection);
582 connect(
ui.buttonCloseLeftHand,
586 Qt::UniqueConnection);
587 connect(
ui.buttonRelaxLeftHand,
591 Qt::UniqueConnection);
592 ui.horizontalSliderLeftHandJointPos->setMaximum(100);
593 ui.horizontalSliderLeftHandJointPos->setMinimum(0);
594 connect(
ui.horizontalSliderLeftHandJointPos,
595 SIGNAL(sliderMoved(
int)),
598 Qt::UniqueConnection);
599 connect(
ui.comboLeftHandJoints,
600 SIGNAL(currentIndexChanged(
int)),
603 Qt::UniqueConnection);
604 connect(
ui.leftExpertMode,
605 &QCheckBox::stateChanged,
606 [&](
int state) { setExpertMode(side::left, state); });
608 &QPushButton::toggled,
609 [&](
bool checked) { tareHand(checked, side::left); });
610 connect(
ui.leftReboot, &QPushButton::clicked, [&] { rebootHand(side::left); });
612 ui.tableWidgetLeftHand->setRowCount(currentLeftHandJointValues.size());
613 ui.tableWidgetLeftHand->setColumnCount(2);
615 ui.comboLeftHandJoints->clear();
617 qRegisterMetaType<QVector<int>>(
"QVector<int>");
618 for (
const auto& pair : currentLeftHandJointValues)
621 QString name(pair.first.c_str());
622 QTableWidgetItem* newItem =
new QTableWidgetItem(name);
623 ui.tableWidgetLeftHand->setItem(frameLeftHandRowIdx, 0, newItem);
624 ui.comboLeftHandJoints->addItem(name);
625 frameLeftHandRowIdx++;
628 ui.comboLeftHandJoints->setCurrentIndex(-1);
631 NameValueMap currentRightHandJointValues = rightHandUnitProxy->getCurrentJointValues();
633 int frameRightHandRowIdx = 0;
635 connect(
ui.buttonPreshapeRightHand,
639 Qt::UniqueConnection);
640 connect(
ui.buttonOpenRightHand,
644 Qt::UniqueConnection);
645 connect(
ui.buttonCloseRightHand,
649 Qt::UniqueConnection);
650 connect(
ui.buttonRelaxRightHand,
654 Qt::UniqueConnection);
655 ui.horizontalSliderRightHandJointPos->setMaximum(100);
656 ui.horizontalSliderRightHandJointPos->setMinimum(0);
657 connect(
ui.horizontalSliderRightHandJointPos,
658 SIGNAL(sliderMoved(
int)),
661 Qt::UniqueConnection);
662 connect(
ui.comboRightHandJoints,
663 SIGNAL(currentIndexChanged(
int)),
666 Qt::UniqueConnection);
667 connect(
ui.rightExpertMode,
668 &QCheckBox::stateChanged,
669 [&](
int state) { setExpertMode(side::right, state); });
670 connect(
ui.rightTare,
671 &QPushButton::clicked,
672 [&](
bool checked) { tareHand(checked, side::right); });
673 connect(
ui.rightReboot, &QPushButton::clicked, [&] { rebootHand(side::right); });
675 ui.tableWidgetRightHand->setRowCount(currentRightHandJointValues.size());
676 ui.tableWidgetRightHand->setColumnCount(2);
678 ui.comboRightHandJoints->clear();
680 qRegisterMetaType<QVector<int>>(
"QVector<int>");
681 for (
const auto& pair : currentRightHandJointValues)
684 QString name(pair.first.c_str());
685 QTableWidgetItem* newItem =
new QTableWidgetItem(name);
686 ui.tableWidgetRightHand->setItem(frameRightHandRowIdx, 0, newItem);
687 ui.comboRightHandJoints->addItem(name);
688 frameRightHandRowIdx++;
691 ui.comboRightHandJoints->setCurrentIndex(-1);
695 connect(
ui.reloadPreshapesButton,
699 Qt::UniqueConnection);