[Orxonox-commit 6537] r11178 - in code/branches/plehmannFS16: data/gui/scripts data/levels src/orxonox/controllers

plehmann at orxonox.net plehmann at orxonox.net
Thu Apr 28 16:08:07 CEST 2016


Author: plehmann
Date: 2016-04-28 16:08:07 +0200 (Thu, 28 Apr 2016)
New Revision: 11178

Modified:
   code/branches/plehmannFS16/data/gui/scripts/testscript.lua
   code/branches/plehmannFS16/data/levels/scriptController.oxw
   code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt
   code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc
   code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc
   code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h
   code/branches/plehmannFS16/src/orxonox/controllers/Task.h
Log:
scriptcontroller task system doesnt work. it seems like queue is the wrong data structure

Modified: code/branches/plehmannFS16/data/gui/scripts/testscript.lua
===================================================================
--- code/branches/plehmannFS16/data/gui/scripts/testscript.lua	2016-04-28 14:04:42 UTC (rev 11177)
+++ code/branches/plehmannFS16/data/gui/scripts/testscript.lua	2016-04-28 14:08:07 UTC (rev 11178)
@@ -22,8 +22,9 @@
 -- If it worked, call its "movetoposition" function
 if ctrl ~= nil then
 
-
-    ctrl:debugOut()
+    --ctrl:printDebug()
+  --ctrl:debugOut(1000)
+  --ctrl:stringOut(10000, "hello")
   --ctrl:eventScheduler("mal", xl,yl,zl, xl,yl,zl, 10)
   -- ctrl:eventScheduler("ral", xl, yl, zl, 3, 3000, 0, math.pi)
   -- ctrl:eventScheduler("idle", 1)

Modified: code/branches/plehmannFS16/data/levels/scriptController.oxw
===================================================================
--- code/branches/plehmannFS16/data/levels/scriptController.oxw	2016-04-28 14:04:42 UTC (rev 11177)
+++ code/branches/plehmannFS16/data/levels/scriptController.oxw	2016-04-28 14:08:07 UTC (rev 11178)
@@ -38,7 +38,7 @@
 
     <Billboard position="2500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
     <DistanceTrigger position="2500,0,0" distance="200" target="Pawn"
-      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
+      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl" stayActive="true"
     />
 
     <StaticEntity position  = "2000,500,2000" mass=10000 collisionType=static >

Modified: code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt	2016-04-28 14:04:42 UTC (rev 11177)
+++ code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt	2016-04-28 14:08:07 UTC (rev 11178)
@@ -4,7 +4,6 @@
   NewHumanController.cc
   ArtificialController.cc
   AIController.cc
-  
   WaypointController.cc
   WaypointPatrolController.cc
   DroneController.cc
@@ -21,4 +20,5 @@
   NewScriptController.cc
   Task.cc
   DebugTask.cc
+  stringOutTask.cc
 )

Modified: code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc	2016-04-28 14:04:42 UTC (rev 11177)
+++ code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc	2016-04-28 14:08:07 UTC (rev 11178)
@@ -45,7 +45,6 @@
 
     void DebugTask::tick(float dt)
     {
-        SUPER(DebugTask, tick, dt);
     	orxout() << "*" << endl;
     }
 

Modified: code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc	2016-04-28 14:04:42 UTC (rev 11177)
+++ code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc	2016-04-28 14:08:07 UTC (rev 11178)
@@ -44,6 +44,7 @@
 #include "NewScriptController.h"
 
 #include "DebugTask.h"
+#include "stringOutTask.h"
 #include "Task.h"
 #include "infos/PlayerInfo.h"
 #include "core/CoreIncludes.h"
@@ -69,11 +70,6 @@
         this->scTime_ = 0.0f;
 
         this->context_ = context;
-
-        task_ = new DebugTask(context);
-
-        //taskQueue_->push(new DebugTask);
-
     }
 
 
@@ -118,22 +114,46 @@
         // If this controller has no entity entry, do nothing 
         if( !(this->entity_) ) return;
 
-        taskQueue_->first()->tick();
+
+/*
+        if(taskQueue_.front()->getStartTime() <= scTime_)
+        {
+          activeTasks_.push_back(taskQueue_.front());
+          taskQueue_.pop();
+        }
+
+        for(Task* task : activeTasks_)
+        {
+          task->tick(dt);
+        }*/
+
+        if(taskQueue_.front() != nullptr)
+        {
+          orxout() << taskQueue_.front() << endl;
+          //taskQueue_.front()->tick(dt);
+        }
     }
 
 
     void NewScriptController::createAndAddTask(Task newTask)
     {
-      taskQueue_->push(newTask);
+      //taskQueue_->push(newTask);
     }
 
     void NewScriptController::debugOut(float startTime)
     {
-      DebugTask* task = new DebugTask(context);
-      task->initialize(10000);
-      taskQueue_->push(task);
+      DebugTask* task = new DebugTask(context_);
+      task->initialize(startTime);
+      taskQueue_.push(task);
     }
 
+    void NewScriptController::stringOut(float startTime, std::string output)
+    {
+      stringOutTask* task = new stringOutTask(context_);
+      task->initialize(startTime, output);
+      taskQueue_.push(task);
+    }
+
     NewScriptController* NewScriptController::getNewScriptController() 
     {
       /* Output a message that confirms this function was called */

Modified: code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h	2016-04-28 14:04:42 UTC (rev 11177)
+++ code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h	2016-04-28 14:08:07 UTC (rev 11178)
@@ -30,6 +30,7 @@
 #define _NewScriptController_H__
 
 #include "DebugTask.h"
+#include "stringOutTask.h"
 #include "Task.h"
 #include "OrxonoxPrereqs.h"                 /* die ganzen tolua, kopiert aus Dock.h*/
 #include "ArtificialController.h"
@@ -56,13 +57,17 @@
 
             // LUA interface
 
-            void debugOut(float startTime);// tolua_export 
+            void debugOut(float startTime);// tolua_export
 
+            void stringOut(float startTime, std::string output);// tolua_export
+
             static NewScriptController* getNewScriptController();// tolua_export 
 
             int getID() { return ctrlid_; }// tolua_export 
 
+            void printDebug() {orxout() << "fffff" << endl;} // tolua_export
 
+
             void createAndAddTask(Task newTask);
 
         private:
@@ -79,18 +84,18 @@
             int ctrlid_;
 
             // List of events to walk through 
-            std::queue<Task*>* taskQueue_;
+            std::queue<Task*> taskQueue_;
 
 
             //List of Tasks currently active 
-            std::vector<Task*>* activeTasks_;
+            std::vector<Task*> activeTasks_;
 
             // Time since the creation of this ScriptController object
             float scTime_;  
 
-            DebugTask* task_;
 
-            context* context_;
+            // context of the Controller to create the tasks
+            Context* context_;
 
 
     };// tolua_export

Modified: code/branches/plehmannFS16/src/orxonox/controllers/Task.h
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/Task.h	2016-04-28 14:04:42 UTC (rev 11177)
+++ code/branches/plehmannFS16/src/orxonox/controllers/Task.h	2016-04-28 14:08:07 UTC (rev 11178)
@@ -31,11 +31,12 @@
 
 #include "infos/PlayerInfo.h"
 #include "tools/interfaces/Tickable.h"
+#include "core/class/OrxonoxClass.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Task : public Tickable
-    {
+    class _OrxonoxExport Task : public OrxonoxClass {
+   
         public:
             Task(Context* context);
             virtual ~Task(){}
@@ -43,7 +44,7 @@
             //this function needs to be called otherwise the task is never carriedout
             void initialize(float startTime);
 
-            virtual void tick(float dt) override;
+            virtual void tick(float dt);
 
             void setIsRunning(bool shouldBeRunning)
                 {isRunning_ = shouldBeRunning;}




More information about the Orxonox-commit mailing list