Skip to content

Commit

Permalink
mtsPIDQtWidget: display desired effort values
Browse files Browse the repository at this point in the history
  • Loading branch information
adeguet1 committed Dec 9, 2015
1 parent b145e84 commit 643318a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
27 changes: 18 additions & 9 deletions code/Qt/mtsPIDQtWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void mtsPIDQtWidget::timerEvent(QTimerEvent * CMN_UNUSED(event))
// display requested joint positions when we are not trying to set it using GUI
if (!DirectControl) {
QVWDesiredPositionWidget->SetValue(PID.StateJointDesired.Position());
QVWDesiredEffortWidget->SetValue(PID.StateJointDesired.Effort());
}

// plot
Expand Down Expand Up @@ -308,6 +309,7 @@ void mtsPIDQtWidget::setupUi(void)
const double maximum = 30000;

QGridLayout * gridLayout = new QGridLayout();
gridLayout->setSpacing(1);

int row = 0;
QLabel * currentPosLabel = new QLabel("Current position (deg)");
Expand All @@ -322,12 +324,27 @@ void mtsPIDQtWidget::setupUi(void)
desiredPosLabel->setAlignment(Qt::AlignRight);
gridLayout->addWidget(desiredPosLabel, row, 0);
QVWDesiredPositionWidget = new vctQtWidgetDynamicVectorDoubleWrite(vctQtWidgetDynamicVectorDoubleWrite::SPINBOX_WIDGET);
// DesiredPositionWidget->SetDecimals(2);
QVWDesiredPositionWidget->SetStep(0.1);
QVWDesiredPositionWidget->SetRange(-360.0, 360.0);
gridLayout->addWidget(QVWDesiredPositionWidget, row, 1);
row++;

QLabel * currentEffortLabel = new QLabel("Current effort (Nm)");
currentEffortLabel->setAlignment(Qt::AlignRight);
gridLayout->addWidget(currentEffortLabel, row, 0);
QVRCurrentEffortWidget = new vctQtWidgetDynamicVectorDoubleRead();
QVRCurrentEffortWidget->SetPrecision(3);
gridLayout->addWidget(QVRCurrentEffortWidget, row, 1);
row++;

QLabel * desiredEffortLabel = new QLabel("Desired effort (Nm)");
desiredEffortLabel->setAlignment(Qt::AlignRight);
gridLayout->addWidget(desiredEffortLabel, row, 0);
QVWDesiredEffortWidget = new vctQtWidgetDynamicVectorDoubleRead();
QVWDesiredEffortWidget->SetPrecision(3);
gridLayout->addWidget(QVWDesiredEffortWidget, row, 1);
row++;

QLabel * pLabel = new QLabel("PGain");
pLabel->setAlignment(Qt::AlignRight);
gridLayout->addWidget(pLabel);
Expand Down Expand Up @@ -358,14 +375,6 @@ void mtsPIDQtWidget::setupUi(void)
gridLayout->addWidget(QVWIGainWidget, row, 1);
row++;

QLabel * currentEffortLabel = new QLabel("Current effort (Nm)");
currentEffortLabel->setAlignment(Qt::AlignRight);
gridLayout->addWidget(currentEffortLabel, row, 0);
QVRCurrentEffortWidget = new vctQtWidgetDynamicVectorDoubleRead();
QVRCurrentEffortWidget->SetPrecision(5);
gridLayout->addWidget(QVRCurrentEffortWidget, row, 1);
row++;

// plot
QHBoxLayout * plotLayout = new QHBoxLayout;
// plot control
Expand Down
7 changes: 4 additions & 3 deletions include/sawControllers/mtsPIDQtWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Author(s): Zihan Chen, Anton Deguet
Created on: 2013-02-20
(C) Copyright 2013-2014 Johns Hopkins University (JHU), All Rights Reserved.
(C) Copyright 2013-2015 Johns Hopkins University (JHU), All Rights Reserved.
--- begin cisst license - do not edit ---
Expand Down Expand Up @@ -129,11 +129,12 @@ private slots:
QPushButton * QPBZeroPosition;
QPushButton * QPBResetPIDGain;
vctQtWidgetDynamicVectorDoubleWrite * QVWDesiredPositionWidget;
vctQtWidgetDynamicVectorDoubleRead * QVRCurrentPositionWidget;
vctQtWidgetDynamicVectorDoubleRead * QVWDesiredEffortWidget;
vctQtWidgetDynamicVectorDoubleRead * QVRCurrentEffortWidget;
vctQtWidgetDynamicVectorDoubleWrite * QVWPGainWidget;
vctQtWidgetDynamicVectorDoubleWrite * QVWDGainWidget;
vctQtWidgetDynamicVectorDoubleWrite * QVWIGainWidget;
vctQtWidgetDynamicVectorDoubleRead * QVRCurrentPositionWidget;
vctQtWidgetDynamicVectorDoubleRead * QVRCurrentEffortWidget;

// GUI: plot
vctPlot2DOpenGLQtWidget * QVPlot;
Expand Down

0 comments on commit 643318a

Please sign in to comment.