Commit 7f336375 authored by Joseph Mirabel's avatar Joseph Mirabel

Better handling of CORBA connection

parent 6bd8c5c5
......@@ -80,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;
......@@ -101,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;
......@@ -131,12 +133,21 @@ namespace hpp {
QByteArray context = getHppContext ().toLatin1();
try {
hpp_->connect (iiop.constData (), context.constData ());
} catch (const CosNaming::NamingContext::NotFound&) {
const char* msg = "Could not find the manipulation server. Is it running ?";
qDebug () << msg;
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(msg);
main->logError(error);
else
qDebug () << error;
if (hpp_) delete hpp_;
hpp_ = NULL;
}
}
......@@ -191,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;
......@@ -214,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;
......@@ -234,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_);
......@@ -255,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_);
......@@ -329,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");
......@@ -400,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();
......@@ -438,6 +455,7 @@ namespace hpp {
void HppManipulationWidgetsPlugin::autoBuildGraph()
{
if (hpp_) return;
if (graphBuilder_ == NULL) {
graphBuilder_ = new QDialog(NULL, Qt::Dialog);
tw_ = new QTabWidget(graphBuilder_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment