From ca40117be06c292a2950934ef9263f2f7b2849cf Mon Sep 17 00:00:00 2001
From: Thomas Moulard <thomas.moulard@gmail.com>
Date: Fri, 26 Nov 2010 22:47:45 +0100
Subject: [PATCH] Make sure ros::init is called before creating the node
 handle.

---
 src/ros_import.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/ros_import.cpp b/src/ros_import.cpp
index 38e236e..c9c1ce2 100644
--- a/src/ros_import.cpp
+++ b/src/ros_import.cpp
@@ -14,18 +14,21 @@ namespace dynamicgraph
 {
   DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(RosImport, "RosImport");
 
-  RosImport::RosImport (const std::string& n)
-    : dynamicgraph::Entity(n),
-      nh_ (),
-      bindedSignal_ ()
+  const char* rosInit()
   {
     int argc = 1;
     char* arg0 = strdup("ros_import");
     char* argv[] = {arg0, 0};
     ros::init(argc, argv, "ros_import");
     free (arg0);
+    return "dynamic_graph";
+  }
 
-    nh_ = ros::NodeHandle ("dynamic_graph");
+  RosImport::RosImport (const std::string& n)
+    : dynamicgraph::Entity(n),
+      nh_ (rosInit ()),
+      bindedSignal_ ()
+  {
   }
 
   RosImport::~RosImport ()
-- 
GitLab