Skip to content
Snippets Groups Projects
Commit ac8b88aa authored by Armar6Demo's avatar Armar6Demo
Browse files

added hand state to info label in hand unit gut

parent f7d010e4
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -33,6 +33,7 @@
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QTimer>
#include <ArmarXCore/observers/variant/SingleTypeVariantList.h>
......@@ -54,6 +55,7 @@ HandUnitWidget::HandUnitWidget() :
ui.setupUi(getWidget());
jointAngleUpdateTask = new PeriodicTask<HandUnitWidget>(this, &HandUnitWidget::setJointAngles, 50);
updateInfoTimer = new QTimer(this);
}
......@@ -68,6 +70,7 @@ void HandUnitWidget::onConnectComponent()
{
connectSlots();
jointAngleUpdateTask->start();
updateInfoTimer->start(50);
handUnitProxy = getProxy<HandUnitInterfacePrx>(handUnitProxyName);
handName = handUnitProxy->getHandName();
......@@ -79,7 +82,7 @@ void HandUnitWidget::onConnectComponent()
ARMARX_WARNING << "Hand with name \"" << handName << "\" is not supported.";
}
ui.labelInfo->setText(QString::fromStdString(handUnitProxyName + " :: " + handName));
//ui.labelInfo->setText(QString::fromStdString(handUnitProxyName + " :: " + handName));
SingleTypeVariantListPtr preshapeStrings = SingleTypeVariantListPtr::dynamicCast(handUnitProxy->getShapeNames());
QStringList list;
......@@ -98,6 +101,7 @@ void HandUnitWidget::onConnectComponent()
void HandUnitWidget::onDisconnectComponent()
{
jointAngleUpdateTask->stop();
updateInfoTimer->stop();
}
void HandUnitWidget::onExitComponent()
......@@ -206,6 +210,11 @@ void HandUnitWidget::relaxHand()
setPreshape("Relax");
}
void HandUnitWidget::updateInfoLabel()
{
ui.labelInfo->setText(QString::fromStdString(handUnitProxyName + " :: " + handName + " State: " + handUnitProxy->describeHandState()));
}
void HandUnitWidget::setPreshape(std::string preshape)
{
ARMARX_INFO << "Setting new hand shape: " << preshape;
......@@ -242,6 +251,7 @@ void HandUnitWidget::connectSlots()
connect(ui.horizontalSliderPalm, SIGNAL(sliderMoved(int)), this, SLOT(requestSetJointAngles()), Qt::UniqueConnection);
connect(ui.horizontalSliderThumbJ0, SIGNAL(sliderMoved(int)), this, SLOT(requestSetJointAngles()), Qt::UniqueConnection);
connect(ui.horizontalSliderThumbJ1, SIGNAL(sliderMoved(int)), this, SLOT(requestSetJointAngles()), Qt::UniqueConnection);
connect(updateInfoTimer, SIGNAL(timeout()), this, SLOT(updateInfoLabel()));
}
......
......@@ -117,6 +117,7 @@ namespace armarx
void closeHand();
void closeThumb();
void relaxHand();
void updateInfoLabel();
private:
void setPreshape(std::string preshape);
......@@ -137,6 +138,7 @@ namespace armarx
QPointer<HandUnitConfigDialog> dialog;
PeriodicTask<HandUnitWidget>::pointer_type jointAngleUpdateTask;
QTimer* updateInfoTimer;
bool setJointAnglesFlag;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment