From 3fe19acc4df0ca82e020ddec004e7f1b656c2f7c Mon Sep 17 00:00:00 2001
From: Olivier Stasse <ostasse@laas.fr>
Date: Wed, 13 Jul 2016 15:08:28 +0200
Subject: [PATCH] sot_loader_basic: Put initializeRosNode as virtual.
 sot_laoder: calls the real time control loop after initializeRosNode.

---
 include/dynamic_graph_bridge/sot_loader.hh       | 2 ++
 include/dynamic_graph_bridge/sot_loader_basic.hh | 4 ++--
 src/sot_loader.cpp                               | 6 +++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/dynamic_graph_bridge/sot_loader.hh b/include/dynamic_graph_bridge/sot_loader.hh
index c05a95a..30672e0 100644
--- a/include/dynamic_graph_bridge/sot_loader.hh
+++ b/include/dynamic_graph_bridge/sot_loader.hh
@@ -89,6 +89,8 @@ public:
   SotLoader();
   ~SotLoader() {};
 
+  // \brief Create a thread for ROS and start the control loop.
+  void initializeRosNode(int argc, char *argv[]);
 
   // \brief Compute one iteration of control.
   // Basically calls fillSensors, the SoT and the readControl.
diff --git a/include/dynamic_graph_bridge/sot_loader_basic.hh b/include/dynamic_graph_bridge/sot_loader_basic.hh
index 10b13b7..6f7fbdf 100644
--- a/include/dynamic_graph_bridge/sot_loader_basic.hh
+++ b/include/dynamic_graph_bridge/sot_loader_basic.hh
@@ -93,8 +93,8 @@ public:
   void Initialization();
 
   // \brief Create a thread for ROS.
-  void initializeRosNode(int argc, char *argv[]);
-
+  virtual void initializeRosNode(int argc, char *argv[]);
+  
 
   // \brief Callback function when starting dynamic graph.
   bool start_dg(std_srvs::Empty::Request& request, 
diff --git a/src/sot_loader.cpp b/src/sot_loader.cpp
index 8c3a4a0..c983ab5 100644
--- a/src/sot_loader.cpp
+++ b/src/sot_loader.cpp
@@ -73,7 +73,11 @@ void SotLoader::startControlLoop()
   boost::thread thr(workThreadLoader, this);
 }
 
-
+void SotLoader::initializeRosNode(int argc, char *argv[])
+{
+  SotLoaderBasic::initializeRosNode(argc, argv);
+  startControlLoop();
+}
 
 void 
 SotLoader::fillSensors(map<string,dgs::SensorValues> & sensorsIn)
-- 
GitLab