Skip to content

Commit

Permalink
Merge pull request #8 from jmirabel/devel
Browse files Browse the repository at this point in the history
Reduce differences between basic and manipulation plugin.
  • Loading branch information
jmirabel authored May 6, 2019
2 parents 95dad16 + 7f33637 commit 20d7e73
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 253 deletions.
4 changes: 0 additions & 4 deletions plugins/hppmanipulationwidgetsplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
HEADERS
hppmanipulationwidgetsplugin.hh
linkwidget.hh
manipulationconstraintwidget.hh
manipulationncpicker.hh

HEADERS_NO_MOC
roadmap.hh
Expand All @@ -44,8 +42,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
hppmanipulationwidgetsplugin.cc
roadmap.cc
linkwidget.cc
manipulationconstraintwidget.cc
manipulationncpicker.cc

LINK_DEPENDENCIES
hppwidgetsplugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include "hppwidgetsplugin/conversions.hh"
#include "hppwidgetsplugin/jointtreewidget.hh"
#include "hppmanipulationwidgetsplugin/linkwidget.hh"
#include "hppmanipulationwidgetsplugin/manipulationconstraintwidget.hh"
#include "hppwidgetsplugin/twojointsconstraint.hh"
#include "hppwidgetsplugin/listjointconstraint.hh"

using CORBA::ULong;

Expand Down Expand Up @@ -83,6 +80,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::loadRobotModel(gepetto::gui::DialogLoadRobot::RobotDefinition rd)
{
if (hpp_) return;
try {
hpp::floatSeq_var q = client ()->robot ()->getCurrentConfig();
(void)q;
Expand All @@ -104,6 +102,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::loadEnvironmentModel(gepetto::gui::DialogLoadEnvironment::EnvironmentDefinition ed)
{
if (hpp_) return;
try {
hpp::floatSeq_var q = client ()->robot ()->getCurrentConfig();
(void)q;
Expand Down Expand Up @@ -132,7 +131,24 @@ namespace hpp {
hpp_ = new HppManipClient (0,0);
QByteArray iiop = getHppIIOPurl ().toLatin1();
QByteArray context = getHppContext ().toLatin1();
hpp_->connect (iiop.constData (), context.constData ());
try {
hpp_->connect (iiop.constData (), context.constData ());
hpp::Names_t_var for_memory_deletion = hpp_->problem()->getAvailable("type");
} catch (const CORBA::Exception& e) {
QString error ("Could not find the manipulation server. Is it running ?");
error += "\n";
error += e._name();
error += " : ";
error += e._rep_id();
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance();
if (main != NULL)
main->logError(error);
else
qDebug () << error;

if (hpp_) delete hpp_;
hpp_ = NULL;
}
}

void HppManipulationWidgetsPlugin::closeConnection()
Expand All @@ -147,17 +163,6 @@ namespace hpp {
return hpp_;
}

void HppManipulationWidgetsPlugin::updateRobotJoints(const QString robotName)
{
Q_UNUSED(robotName)
hpp::Names_t_var joints = client()->robot()->getAllJointNames ();
for (size_t i = 0; i < joints->length (); ++i) {
const char* jname = joints[(ULong) i];
hpp::Names_t_var lnames = client()->robot()->getLinkNames (jname);
jointMap_[jname] = JointElement(jname, "", lnames, 0, true);
}
}

Roadmap *HppManipulationWidgetsPlugin::createRoadmap(const std::string &jointName)
{
ManipulationRoadmap* r = new ManipulationRoadmap(this);
Expand Down Expand Up @@ -197,6 +202,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::drawRobotContacts()
{
if (hpp_) return;
hpp::Names_t_var rcs = hpp_->problem()->getRobotContactNames();
hpp::floatSeqSeq_var points;
hpp::intSeq_var indexes;
Expand All @@ -220,6 +226,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::drawEnvironmentContacts()
{
if (hpp_) return;
hpp::Names_t_var rcs = hpp_->problem()->getEnvironmentContactNames();
hpp::floatSeqSeq_var points;
hpp::intSeq_var indexes;
Expand All @@ -240,6 +247,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::drawHandlesFrame()
{
if (hpp_) return;
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance ();
hpp::Names_t_var rcs = hpp_->problem()->getAvailable("handle");
hpp::Transform__var t (new Transform_);
Expand All @@ -261,6 +269,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::drawGrippersFrame()
{
if (hpp_) return;
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance ();
hpp::Names_t_var rcs = hpp_->problem()->getAvailable("gripper");
hpp::Transform__var t (new Transform_);
Expand Down Expand Up @@ -335,6 +344,7 @@ namespace hpp {

HppManipulationWidgetsPlugin::MapNames HppManipulationWidgetsPlugin::getObjects()
{
assert (hpp_ != NULL);
HppManipulationWidgetsPlugin::MapNames map;
hpp::Names_t_var handles = manipClient()->problem()->getAvailable("handle");
hpp::Names_t_var surfaces = manipClient()->problem()->getAvailable("robotcontact");
Expand Down Expand Up @@ -406,6 +416,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::buildGraph()
{
if (hpp_) return;
QListWidget* l = dynamic_cast<QListWidget*>(tw_->widget(0));
HppManipulationWidgetsPlugin::MapNames handlesMap = getObjects();
HppManipulationWidgetsPlugin::MapNames shapesMap = getObjects();
Expand Down Expand Up @@ -444,6 +455,7 @@ namespace hpp {

void HppManipulationWidgetsPlugin::autoBuildGraph()
{
if (hpp_) return;
if (graphBuilder_ == NULL) {
graphBuilder_ = new QDialog(NULL, Qt::Dialog);
tw_ = new QTabWidget(graphBuilder_);
Expand Down Expand Up @@ -511,22 +523,6 @@ namespace hpp {
graphBuilder_->show();
}

void HppManipulationWidgetsPlugin::loadConstraintWidget()
{
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance();
QDockWidget* dock = new QDockWidget ("&Constraint creator", main);
dock->setObjectName ("hppmanipulationwidgetsplugin.constraintcreator");
constraintWidget_ = new ManipulationConstraintWidget (this, dock);
dock->setWidget(constraintWidget_);
main->insertDockWidget (dock, Qt::RightDockWidgetArea, Qt::Vertical);
dock->toggleViewAction()->setShortcut(gepetto::gui::DockKeyShortcutBase + Qt::Key_V);
dockWidgets_.append(dock);
constraintWidget_->addConstraint(new PositionConstraint(this));
constraintWidget_->addConstraint(new OrientationConstraint(this));
constraintWidget_->addConstraint(new TransformConstraint(this));
constraintWidget_->addConstraint(new LockedJointConstraint(this));
}

#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
Q_EXPORT_PLUGIN2 (hppmanipulationwidgetsplugin, HppManipulationWidgetsPlugin)
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ namespace hpp {
/// Get the instance of corba manipulation client.
HppManipClient* manipClient () const;

/// Get the list of joints from corbaserver and update internal joint map.
/// \param robotName name of the robot (unused)
void updateRobotJoints (const QString robotName);

/// Create the roadmap of a given joint.
/// \param jointName name of the joint
virtual Roadmap* createRoadmap (const std::string& jointName);
Expand All @@ -100,9 +96,6 @@ namespace hpp {
/// Construct all the corba vars and create the graph.
void buildGraph();

protected:
virtual void loadConstraintWidget();

private:
// Type used to make one function to build datas needed for autoBuild
typedef std::pair<hpp::Names_t, hpp::corbaserver::manipulation::Namess_t> NamesPair;
Expand Down

This file was deleted.

This file was deleted.

81 changes: 0 additions & 81 deletions plugins/hppmanipulationwidgetsplugin/manipulationncpicker.cc

This file was deleted.

Loading

0 comments on commit 20d7e73

Please sign in to comment.