Skip to content

Commit 20d7e73

Browse files
authored
Merge pull request #8 from jmirabel/devel
Reduce differences between basic and manipulation plugin.
2 parents 95dad16 + 7f33637 commit 20d7e73

File tree

9 files changed

+40
-253
lines changed

9 files changed

+40
-253
lines changed

plugins/hppmanipulationwidgetsplugin/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
3131
HEADERS
3232
hppmanipulationwidgetsplugin.hh
3333
linkwidget.hh
34-
manipulationconstraintwidget.hh
35-
manipulationncpicker.hh
3634

3735
HEADERS_NO_MOC
3836
roadmap.hh
@@ -44,8 +42,6 @@ GEPETTO_GUI_PLUGIN(hppmanipulationwidgetsplugin
4442
hppmanipulationwidgetsplugin.cc
4543
roadmap.cc
4644
linkwidget.cc
47-
manipulationconstraintwidget.cc
48-
manipulationncpicker.cc
4945

5046
LINK_DEPENDENCIES
5147
hppwidgetsplugin

plugins/hppmanipulationwidgetsplugin/hppmanipulationwidgetsplugin.cc

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
#include "hppwidgetsplugin/conversions.hh"
2222
#include "hppwidgetsplugin/jointtreewidget.hh"
2323
#include "hppmanipulationwidgetsplugin/linkwidget.hh"
24-
#include "hppmanipulationwidgetsplugin/manipulationconstraintwidget.hh"
25-
#include "hppwidgetsplugin/twojointsconstraint.hh"
26-
#include "hppwidgetsplugin/listjointconstraint.hh"
2724

2825
using CORBA::ULong;
2926

@@ -83,6 +80,7 @@ namespace hpp {
8380

8481
void HppManipulationWidgetsPlugin::loadRobotModel(gepetto::gui::DialogLoadRobot::RobotDefinition rd)
8582
{
83+
if (hpp_) return;
8684
try {
8785
hpp::floatSeq_var q = client ()->robot ()->getCurrentConfig();
8886
(void)q;
@@ -104,6 +102,7 @@ namespace hpp {
104102

105103
void HppManipulationWidgetsPlugin::loadEnvironmentModel(gepetto::gui::DialogLoadEnvironment::EnvironmentDefinition ed)
106104
{
105+
if (hpp_) return;
107106
try {
108107
hpp::floatSeq_var q = client ()->robot ()->getCurrentConfig();
109108
(void)q;
@@ -132,7 +131,24 @@ namespace hpp {
132131
hpp_ = new HppManipClient (0,0);
133132
QByteArray iiop = getHppIIOPurl ().toLatin1();
134133
QByteArray context = getHppContext ().toLatin1();
135-
hpp_->connect (iiop.constData (), context.constData ());
134+
try {
135+
hpp_->connect (iiop.constData (), context.constData ());
136+
hpp::Names_t_var for_memory_deletion = hpp_->problem()->getAvailable("type");
137+
} catch (const CORBA::Exception& e) {
138+
QString error ("Could not find the manipulation server. Is it running ?");
139+
error += "\n";
140+
error += e._name();
141+
error += " : ";
142+
error += e._rep_id();
143+
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance();
144+
if (main != NULL)
145+
main->logError(error);
146+
else
147+
qDebug () << error;
148+
149+
if (hpp_) delete hpp_;
150+
hpp_ = NULL;
151+
}
136152
}
137153

138154
void HppManipulationWidgetsPlugin::closeConnection()
@@ -147,17 +163,6 @@ namespace hpp {
147163
return hpp_;
148164
}
149165

150-
void HppManipulationWidgetsPlugin::updateRobotJoints(const QString robotName)
151-
{
152-
Q_UNUSED(robotName)
153-
hpp::Names_t_var joints = client()->robot()->getAllJointNames ();
154-
for (size_t i = 0; i < joints->length (); ++i) {
155-
const char* jname = joints[(ULong) i];
156-
hpp::Names_t_var lnames = client()->robot()->getLinkNames (jname);
157-
jointMap_[jname] = JointElement(jname, "", lnames, 0, true);
158-
}
159-
}
160-
161166
Roadmap *HppManipulationWidgetsPlugin::createRoadmap(const std::string &jointName)
162167
{
163168
ManipulationRoadmap* r = new ManipulationRoadmap(this);
@@ -197,6 +202,7 @@ namespace hpp {
197202

198203
void HppManipulationWidgetsPlugin::drawRobotContacts()
199204
{
205+
if (hpp_) return;
200206
hpp::Names_t_var rcs = hpp_->problem()->getRobotContactNames();
201207
hpp::floatSeqSeq_var points;
202208
hpp::intSeq_var indexes;
@@ -220,6 +226,7 @@ namespace hpp {
220226

221227
void HppManipulationWidgetsPlugin::drawEnvironmentContacts()
222228
{
229+
if (hpp_) return;
223230
hpp::Names_t_var rcs = hpp_->problem()->getEnvironmentContactNames();
224231
hpp::floatSeqSeq_var points;
225232
hpp::intSeq_var indexes;
@@ -240,6 +247,7 @@ namespace hpp {
240247

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

262270
void HppManipulationWidgetsPlugin::drawGrippersFrame()
263271
{
272+
if (hpp_) return;
264273
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance ();
265274
hpp::Names_t_var rcs = hpp_->problem()->getAvailable("gripper");
266275
hpp::Transform__var t (new Transform_);
@@ -335,6 +344,7 @@ namespace hpp {
335344

336345
HppManipulationWidgetsPlugin::MapNames HppManipulationWidgetsPlugin::getObjects()
337346
{
347+
assert (hpp_ != NULL);
338348
HppManipulationWidgetsPlugin::MapNames map;
339349
hpp::Names_t_var handles = manipClient()->problem()->getAvailable("handle");
340350
hpp::Names_t_var surfaces = manipClient()->problem()->getAvailable("robotcontact");
@@ -406,6 +416,7 @@ namespace hpp {
406416

407417
void HppManipulationWidgetsPlugin::buildGraph()
408418
{
419+
if (hpp_) return;
409420
QListWidget* l = dynamic_cast<QListWidget*>(tw_->widget(0));
410421
HppManipulationWidgetsPlugin::MapNames handlesMap = getObjects();
411422
HppManipulationWidgetsPlugin::MapNames shapesMap = getObjects();
@@ -444,6 +455,7 @@ namespace hpp {
444455

445456
void HppManipulationWidgetsPlugin::autoBuildGraph()
446457
{
458+
if (hpp_) return;
447459
if (graphBuilder_ == NULL) {
448460
graphBuilder_ = new QDialog(NULL, Qt::Dialog);
449461
tw_ = new QTabWidget(graphBuilder_);
@@ -511,22 +523,6 @@ namespace hpp {
511523
graphBuilder_->show();
512524
}
513525

514-
void HppManipulationWidgetsPlugin::loadConstraintWidget()
515-
{
516-
gepetto::gui::MainWindow* main = gepetto::gui::MainWindow::instance();
517-
QDockWidget* dock = new QDockWidget ("&Constraint creator", main);
518-
dock->setObjectName ("hppmanipulationwidgetsplugin.constraintcreator");
519-
constraintWidget_ = new ManipulationConstraintWidget (this, dock);
520-
dock->setWidget(constraintWidget_);
521-
main->insertDockWidget (dock, Qt::RightDockWidgetArea, Qt::Vertical);
522-
dock->toggleViewAction()->setShortcut(gepetto::gui::DockKeyShortcutBase + Qt::Key_V);
523-
dockWidgets_.append(dock);
524-
constraintWidget_->addConstraint(new PositionConstraint(this));
525-
constraintWidget_->addConstraint(new OrientationConstraint(this));
526-
constraintWidget_->addConstraint(new TransformConstraint(this));
527-
constraintWidget_->addConstraint(new LockedJointConstraint(this));
528-
}
529-
530526
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
531527
Q_EXPORT_PLUGIN2 (hppmanipulationwidgetsplugin, HppManipulationWidgetsPlugin)
532528
#endif

plugins/hppmanipulationwidgetsplugin/hppmanipulationwidgetsplugin.hh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ namespace hpp {
7272
/// Get the instance of corba manipulation client.
7373
HppManipClient* manipClient () const;
7474

75-
/// Get the list of joints from corbaserver and update internal joint map.
76-
/// \param robotName name of the robot (unused)
77-
void updateRobotJoints (const QString robotName);
78-
7975
/// Create the roadmap of a given joint.
8076
/// \param jointName name of the joint
8177
virtual Roadmap* createRoadmap (const std::string& jointName);
@@ -100,9 +96,6 @@ namespace hpp {
10096
/// Construct all the corba vars and create the graph.
10197
void buildGraph();
10298

103-
protected:
104-
virtual void loadConstraintWidget();
105-
10699
private:
107100
// Type used to make one function to build datas needed for autoBuild
108101
typedef std::pair<hpp::Names_t, hpp::corbaserver::manipulation::Namess_t> NamesPair;

plugins/hppmanipulationwidgetsplugin/manipulationconstraintwidget.cc

Lines changed: 0 additions & 60 deletions
This file was deleted.

plugins/hppmanipulationwidgetsplugin/manipulationconstraintwidget.hh

Lines changed: 0 additions & 34 deletions
This file was deleted.

plugins/hppmanipulationwidgetsplugin/manipulationncpicker.cc

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)