From 90c6014bba26fadb5ea8776f1aa9297fc9651757 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Mon, 8 Jun 2020 09:44:21 +0200
Subject: [PATCH] Made protected the BT factory object so the inherted class
 can access it. Removed the abstract init function. All the initialization
 should be done in the constructor of the inherited class.

---
 .../iri_base_bt_client/iri_base_bt_client.h   | 23 ++++++-------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/include/iri_base_bt_client/iri_base_bt_client.h b/include/iri_base_bt_client/iri_base_bt_client.h
index c965944..5074622 100644
--- a/include/iri_base_bt_client/iri_base_bt_client.h
+++ b/include/iri_base_bt_client/iri_base_bt_client.h
@@ -97,12 +97,6 @@ class IriBaseBTClient
     */
     std::string tree_xml_file;
 
-    /**
-    * \brief 
-    * 
-    */
-    IriBehaviorTreeFactory factory;
-
     /**
     * \brief 
     * 
@@ -126,6 +120,12 @@ class IriBaseBTClient
     */
     IriBTBasicNodes core;
 
+    /**
+    * \brief 
+    * 
+    */
+    IriBehaviorTreeFactory factory;
+
    /**
     * \brief define config type
     *
@@ -314,12 +314,6 @@ class IriBaseBTClient
     */
     double getRate(void);
 
-    /**
-    * \brief 
-    * 
-    */
-    virtual void init(IriBehaviorTreeFactory &factory) = 0;
-
    /**
     * \brief dynamic reconfigure server callback
     * 
@@ -665,9 +659,6 @@ void *IriBaseBTClient<ConfigClass>::mainThread(void *param)
   // retrieve base algorithm class
   IriBaseBTClient *iriNode = (IriBaseBTClient *)param;
 
-  // initialize user actions and conditions
-  iriNode->init(iriNode->factory);
-
   try
   {
     // creation of tree from .xml
@@ -730,7 +721,7 @@ int IriBaseBTClient<ConfigClass>::spin(void)
     // update diagnostics
     this->diagnostic_.update();
     
-    ros::WallDuration(0.1).sleep();
+    ros::WallDuration(this->diagnostic_.getPeriod()).sleep();
   }
 
   // stop ros
-- 
GitLab