Skip to content
Snippets Groups Projects
Commit 0a31047f authored by Markus Grotz's avatar Markus Grotz
Browse files

added copy values button to KinematicUnitGui widget

parent 0250dfcc
No related branches found
Tags v0.3.2
No related merge requests found
Pipeline #
......@@ -32,6 +32,8 @@
#include <ArmarXCore/core/ArmarXObjectScheduler.h>
#include <ArmarXCore/core/ArmarXManager.h>
#include <ArmarXCore/util/json/JSONObject.h>
#include <VirtualRobot/XML/RobotIO.h>
// Qt headers
......@@ -44,6 +46,7 @@
#include <QTableView>
#include <QCheckBox>
#include <QTableWidget>
#include <QClipboard>
#include <Inventor/SoDB.h>
#include <Inventor/Qt/SoQt.h>
......@@ -160,7 +163,7 @@ void KinematicUnitWidgetController::onConnectComponent()
packages.push_back(Application::GetProjectName());
ARMARX_VERBOSE << "ArmarX packages " << packages;
for (const std::string& projectName : packages)
for (const std::string & projectName : packages)
{
if (projectName.empty())
{
......@@ -336,6 +339,8 @@ void KinematicUnitWidgetController::saveSettings(QSettings* settings)
}
void KinematicUnitWidgetController::showVisuLayers(bool show)
{
if (debugDrawer)
......@@ -351,6 +356,34 @@ void KinematicUnitWidgetController::showVisuLayers(bool show)
}
}
void KinematicUnitWidgetController::copyToClipboard()
{
NameValueMap values;
{
boost::recursive_mutex::scoped_lock lock(mutexNodeSet);
if (selectedControlMode == ePositionControl)
{
values = reportedJointAngles;
}
else if (selectedControlMode == eVelocityControl)
{
values = reportedJointVelocities;
}
}
JSONObjectPtr serializer = new JSONObject();
for (auto & kv : values)
{
serializer->setFloat(kv.first, kv.second);
}
const QString json = QString::fromStdString(serializer->asString(true));
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(json);
QApplication::processEvents();
}
void KinematicUnitWidgetController::updateGuiElements()
{
// modelUpdateCB();
......@@ -380,6 +413,7 @@ void KinematicUnitWidgetController::connectSlots()
connect(ui.radioButtonVelocityControl, SIGNAL(clicked(bool)), this, SLOT(setControlModeVelocity()));
connect(ui.radioButtonTorqueControl, SIGNAL(clicked(bool)), this, SLOT(setControlModeTorque()));
connect(ui.copyToClipboard, SIGNAL(clicked()), this, SLOT(copyToClipboard()));
connect(ui.showDebugLayer, SIGNAL(toggled(bool)), this, SLOT(showVisuLayers(bool)), Qt::QueuedConnection);
connect(this, SIGNAL(jointAnglesReported()), this, SLOT(updateJointAnglesTable()), Qt::QueuedConnection);
......@@ -858,14 +892,14 @@ void KinematicUnitWidgetController::updateControlModesTable()
switch (currentMode)
{
/*case eNoMode:
state = "None";
break;
case eUnknownMode:
state = "Unknown";
break;
*/
/*case eNoMode:
state = "None";
break;
case eUnknownMode:
state = "Unknown";
break;
*/
case eDisabled:
state = "Disabled";
break;
......@@ -1171,7 +1205,7 @@ void KinematicUnitWidgetController::reportControlModeChanged(const NameControlMo
// return;
boost::recursive_mutex::scoped_lock lock(mutexNodeSet);
for (auto& e : jointModes)
for (auto & e : jointModes)
{
// ARMARX_INFO << "Setting jointMode of joint " << e.first << " to " << e.second;
......
......@@ -253,6 +253,7 @@ namespace armarx
protected slots:
void showVisuLayers(bool show);
void copyToClipboard();
private:
boost::recursive_mutex mutexNodeSet;
......
......@@ -46,7 +46,14 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="2" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Select Joint</string>
</property>
</widget>
</item>
<item row="2" column="2" colspan="3">
<widget class="QComboBox" name="nodeListComboBox">
<property name="enabled">
<bool>true</bool>
......@@ -59,7 +66,7 @@
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<item row="3" column="2" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButtonPositionControl">
......@@ -157,10 +164,7 @@
</item>
</layout>
</item>
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_4"/>
</item>
<item row="5" column="3">
<item row="6" column="4">
<widget class="QCheckBox" name="showDebugLayer">
<property name="text">
<string>debug layer</string>
......@@ -170,29 +174,24 @@
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QSlider" name="horizontalSliderKinematicUnitPos">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_4"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Control Mode</string>
</property>
<property name="tickInterval">
<number>0</number>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="labelUnit">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLCDNumber" name="lcdNumberKinematicUnitJointValue">
<property name="enabled">
<bool>true</bool>
......@@ -211,24 +210,32 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="labelUnit">
<property name="text">
<string/>
<item row="6" column="2">
<widget class="QSlider" name="horizontalSliderKinematicUnitPos">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Control Mode</string>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label">
<item row="6" column="3">
<widget class="QPushButton" name="copyToClipboard">
<property name="text">
<string>Select Joint</string>
<string>Copy Values</string>
</property>
</widget>
</item>
......
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