...
 
Commits (10)
......@@ -24,15 +24,16 @@ SET(CXX_DISABLE_WERROR TRUE)
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake/hpp.cmake)
# Tells pkg-config to read qtversion and cmake_plugin from pkg config file.
LIST(APPEND PKG_CONFIG_ADDITIONAL_VARIABLES qtversion cmake_plugin)
SET(PROJECT_NAME "hpp-gui")
SET(PROJECT_URL "https://github.com/jmirabel/hpp-gui")
SET(PROJECT_URL "https://github.com/humanoid-path-planner/hpp-gui")
SET(PROJECT_DESCRIPTION "Graphical interface for HPP ")
SETUP_PROJECT()
SETUP_HPP_PROJECT()
ADD_REQUIRED_DEPENDENCY("gepetto-viewer-corba >= 1.3")
......@@ -96,4 +97,4 @@ ELSE ()
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui)
ENDIF ()
SETUP_PROJECT_FINALIZE()
SETUP_HPP_PROJECT_FINALIZE()
Subproject commit 37328d715825baa3bdd7860f8561c68a0a3ff76c
Subproject commit ecaf20c28c8ce33de312fbd812f88037cf995b73
FILE_PATTERNS = *.hh
FILE_PATTERNS = *.hh *.py
INPUT = @CMAKE_SOURCE_DIR@/plugins/hppcorbaserverplugin \
INPUT = @CMAKE_SOURCE_DIR@/pyplugins \
@CMAKE_SOURCE_DIR@/plugins/hppcorbaserverplugin \
@CMAKE_SOURCE_DIR@/plugins/hppwidgetsplugin \
@CMAKE_SOURCE_DIR@/plugins/hppmanipulationwidgetsplugin \
TAGFILES = @HPP_CORBASERVER_DOXYGENDOCDIR@/hpp-core.doxytag=@HPP_CORE_DOXYGENDOCDIR@ \
@HPP_MANIPULATION_CORBA_DOXYGENDOCDIR@/hpp-manipulation-corba=@HPP_MANIPULATION_CORBA_DOXYGENDOCDIR@
......@@ -5,6 +5,8 @@
#include "hppmanipulationwidgetsplugin/hppmanipulationwidgetsplugin.hh"
#include <sstream>
#include <QAction>
#include <QDockWidget>
#include <QLayout>
......
......@@ -235,6 +235,20 @@ namespace hpp {
return &config_;
}
void HppWidgetsPlugin::setCurrentQtConfig (const QVector<double>& q)
{
config_ .length (q.size());
for (ULong i = 0; i < config_.length(); ++i) config_[i] = q[i];
MainWindow::instance()->requestApplyCurrentConfiguration();
}
QVector<double> HppWidgetsPlugin::getCurrentQtConfig () const
{
QVector<double> c (config_.length());
for (ULong i = 0; i < config_.length(); ++i) c[i] = config_[i];
return c;
}
bool HppWidgetsPlugin::corbaException(int jobId, const CORBA::Exception &excep) const
{
try {
......
......@@ -134,6 +134,10 @@ signals:
hpp::floatSeq const* getCurrentConfig () const;
void setCurrentQtConfig (const QVector<double>& q);
QVector<double> getCurrentQtConfig () const;
/// Set internal configuration from HPP current config.
void fetchConfiguration ();
......
......@@ -267,11 +267,8 @@ namespace hpp {
switch (type) {
case JointTreeItem::SkipType:
return;
case JointTreeItem::IntegratorType:{
hpp::floatSeq_var q = plugin_->client()->robot()->getJointConfig (ji->name().c_str());
ji->updateConfig(q.in());
return;
}
case JointTreeItem::IntegratorType:
return;
case JointTreeItem::BoundedValueType: {
SliderBoundedJoint* slider = static_cast <SliderBoundedJoint*> (editor);
q = slider->getValue();
......@@ -288,11 +285,12 @@ namespace hpp {
}
model->setData(index, q, Qt::EditRole);
assert (ji);
ULong idxCfg = (ULong)index.data(JointTreeItem::IndexRole).toInt();
switch (type) {
case JointTreeItem::BoundedValueType:
return;
case JointTreeItem::UnboundedValueType:
plugin_->client()->robot()->setJointConfig (ji->name().c_str(), ji->config());
plugin_->currentConfig()[ji->rankInConfig()+idxCfg] = q;
break;
case JointTreeItem::BoundType:
plugin_->client()->robot()->setJointBounds (ji->name().c_str(), ji->bounds());
......
......@@ -5,6 +5,8 @@
#include "hppwidgetsplugin/pathplayer.hh"
#include <sstream>
#include <QProgressDialog>
#include <QSlider>
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
......
......@@ -10,6 +10,12 @@
<height>64</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Path player</string>
</property>
......
......@@ -96,7 +96,7 @@ namespace hpp {
vecDouble[i + 1] = ui->secondYPosition->value();
vecDouble[i + 2] = ui->secondZPosition->value();
}
emit finished(std::make_pair<QVector<double>, QVector<bool> >(vecDouble, vecBool));
emit finished(std::make_pair (vecDouble, vecBool));
this->deleteLater();
this->close();
}
......
......@@ -30,3 +30,6 @@ INSTALL(
${CMAKE_CURRENT_SOURCE_DIR}/hpp/gui/__init__.py
DESTINATION ${PYTHON_SITELIB}/hpp/gui
)
GEPETTO_GUI_PYPLUGIN(hpp/gui/plugin.py)
GEPETTO_GUI_PYPLUGIN(hpp/gui/dynamicbuild.py)
# GEPETTO_GUI_PYPLUGIN(hpp/gui/graphutility.py)
# This file is only necessary for generating the documentation
# of Python code in hpp.gui package. This __init__ file
# makes Doxygen understand hpp is a package.
......@@ -17,14 +17,22 @@ class DirectPathBox(QtGui.QGroupBox):
def shootRandom(self):
q = self.plugin.client.robot.shootRandomConfig()
self.plugin.client.robot.setCurrentConfig(q)
self.plugin.main.requestApplyCurrentConfiguration()
self.plugin.hppPlugin.setCurrentQtConfig(q)
def applyConstraints (self):
q0 = self.plugin.hppPlugin.getCurrentQtConfig()
res, q1, err = self.plugin.client.problem.applyConstraints (q0)
self.plugin.hppPlugin.setCurrentQtConfig(q1)
if not res:
self.plugin.main.logError ("Projection failed: " + str(err))
else:
self.plugin.main.logError ("Projection succeeded.")
def getFrom (self):
self.fromCfg = self.plugin.client.robot.getCurrentConfig()
self.fromCfg = self.plugin.hppPlugin.getCurrentQtConfig()
def getTo (self):
self.toCfg = self.plugin.client.robot.getCurrentConfig()
self.toCfg = self.plugin.hppPlugin.getCurrentQtConfig()
def makePath (self):
n = self.plugin.client.robot.getConfigSize()
......@@ -47,6 +55,8 @@ class DirectPathBox(QtGui.QGroupBox):
box = QtGui.QVBoxLayout(self)
random = QtGui.QPushButton(self)
box.addWidget(random)
applyConstraints = QtGui.QPushButton(self)
box.addWidget(applyConstraints)
setFrom = QtGui.QPushButton(self)
box.addWidget(setFrom)
setTo = QtGui.QPushButton(self)
......@@ -58,12 +68,14 @@ class DirectPathBox(QtGui.QGroupBox):
makePath = QtGui.QPushButton(self)
box.addWidget(makePath)
random.text = "Shoot random config"
applyConstraints.text = "Apply constraints"
setFrom.text = 'Save config as origin'
setTo.text = 'Save config as destination'
self.validatePath.text = 'Validate path'
self.projectPath.text = "Project path"
makePath.text = 'Create path'
random.connect('clicked()', self.shootRandom)
applyConstraints.connect('clicked()', self.applyConstraints)
setFrom.connect('clicked()', self.getFrom)
setTo.connect('clicked()', self.getTo)
makePath.connect('clicked()', self.makePath)
......@@ -204,7 +204,7 @@ class _GraspMode(QWidget):
def graspCurrent(self):
if (len(self.handles) > 0 and len(self.grippers) > 0):
self.grasp(self.parentInstance.plugin.client.basic.robot.getCurrentConfig())
self.grasp(self.parentInstance.plugin.hppPlugin.getCurrentQtConfig())
def graspRandom(self):
if (len(self.handles) > 0 and len(self.grippers) > 0):
......@@ -224,12 +224,11 @@ class _GraspMode(QWidget):
self.parentInstance.plugin.client.basic.problem.addNumericalConstraints("constraints", [name,], [0,])
res = self.parentInstance.plugin.client.basic.problem.applyConstraints(config)
if res[0] == True:
self.parentInstance.plugin.client.basic.robot.setCurrentConfig(res[1])
self.mainWindow.requestApplyCurrentConfiguration()
self.parentInstance.plugin.hppPlugin.setCurrentQtConfig(res[1])
def pregraspCurrent(self):
if (len(self.handles) > 0 and len(self.grippers) > 0):
self.pregrasp(self.parentInstance.plugin.client.basic.robot.getCurrentConfig())
self.pregrasp(self.parentInstance.plugin.hppPlugin.getCurrentQtConfig())
def pregraspRandom(self):
if (len(self.handles) > 0 and len(self.grippers) > 0):
......@@ -242,10 +241,9 @@ class _GraspMode(QWidget):
name = self.grippers[self.currentGripper] + " pregrasps " + self.handles[self.currentHandle]
self.parentInstance.plugin.client.manipulation.problem.createGrasp(name, self.grippers[self.currentGripper], self.handles[self.currentHandle])
self.parentInstance.plugin.client.basic.problem.addNumericalConstraints("constraints", [name], [True])
res = self.parentInstance.plugin.client.basic.problem.applyConstraints(self.parentInstance.plugin.client.basic.robot.getCurrentConfig())
res = self.parentInstance.plugin.client.basic.problem.applyConstraints(self.parentInstance.plugin.hppPlugin.getCurrentQtConfig())
if (res[0] == True):
self.parentInstance.plugin.client.basic.robot.setCurrentConfig(res[1])
self.mainWindow.requestApplyCurrentConfiguration()
self.parentInstance.plugin.hppPlugin.setCurrentQtConfig(res[1])
def lock(self):
if (self.selected != ""):
......@@ -314,10 +312,9 @@ class _PlacementMode(QWidget):
[self.surfaceName], [self.carryName])
self.parent().plugin.client.basic.problem.addNumericalConstraints("numerical", ["placement"], [True])
res = self.parent().plugin.client.basic.problem.applyConstraints(self.parent().plugin.client.basic.robot.getCurrentConfig())
res = self.parent().plugin.client.basic.problem.applyConstraints(self.parent().plugin.hppPlugin.getCurrentQtConfig())
if res[0]:
self.parent().plugin.client.basic.robot.setCurrentConfig(res[1])
self.parent().mainWindow.requestApplyCurrentConfiguration()
self.parent().plugin.hppPlugin.setCurrentQtConfig(res[1])
def createWidget(self):
box = QVBoxLayout(self)
......@@ -379,6 +376,7 @@ class Plugin(QDockWidget):
self.setObjectName ("hpp.gui.dynamicbuild")
self.osg = None
self.mainWindow = mainWindow
self.hppPlugin = mainWindow.getFromSlot("getHppIIOPurl")
self.resetConnection()
mainWindow.registerShortcut("Dynamic builder", "Toggle view", self.toggleViewAction())
self.dynamicBuilder = _DynamicBuilder(mainWindow, self)
......