[Fawkes Git] branch/sschoenitz/state_timer: created (0.5.0-3085-g16ac1f4)

Sebastian Schoenitz sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de
Fri Apr 15 13:53:36 CEST 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, sschoenitz/state_timer has been created
        at  16ac1f49ba873a306af3e8116648b3dd91da4f42 (commit)

http://git.fawkesrobotics.org/fawkes.git/sschoenitz/state_timer

- *Log* ---------------------------------------------------------------
commit cdc344e67a9436e8d130298b8e218f3f187e07ca
Author:     Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
AuthorDate: Thu Apr 14 10:57:06 2016 +0200
Commit:     Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
CommitDate: Thu Apr 14 14:36:14 2016 +0200

    jumpstate.lua: Measuring the time within states
    
    Changed do_init() to measure the time entering a state.
    Writing own do_exit() in order to measure the time leaving a state and
    cumulate the time spend in this state.

http://git.fawkesrobotics.org/fawkes.git/commit/cdc344e
http://trac.fawkesrobotics.org/changeset/cdc344e

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 053b3229aa7963e5c197aca4dec9ff2943e9d383
Author:     Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
AuthorDate: Fri Apr 15 13:27:00 2016 +0200
Commit:     Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
CommitDate: Fri Apr 15 13:27:00 2016 +0200

    subskill_jumpstate.lua: Measuring time in states
    
    Changed do_init() to measure the time entering a state.
    Changed do_exit() in order to measure the time leaving a state and
    cumulate the time spend in this state.
    Changed reset() in order to reset the cumulative time measured.
    Additionally providing the time information via print_debug.

http://git.fawkesrobotics.org/fawkes.git/commit/053b322
http://trac.fawkesrobotics.org/changeset/053b322

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 16ac1f49ba873a306af3e8116648b3dd91da4f42
Author:     Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
AuthorDate: Fri Apr 15 13:39:31 2016 +0200
Commit:     Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
CommitDate: Fri Apr 15 13:39:31 2016 +0200

    jumpstate.lua: Logging times via debug
    
    Adding debug_print to do_exit() in order to log the time information.
    Invoking the inherited exit function from fawkes.fsm.state.

http://git.fawkesrobotics.org/fawkes.git/commit/16ac1f4
http://trac.fawkesrobotics.org/changeset/16ac1f4

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/lua/fawkes/fsm/jumpstate.lua       |   21 +++++++++++++++++----
 src/lua/skiller/subskill_jumpstate.lua |   11 +++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* cdc344e67a9436e8d130298b8e218f3f187e07ca - - - - - - - - - -
Author:  Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
Date:    Thu Apr 14 10:57:06 2016 +0200
Subject: jumpstate.lua: Measuring the time within states

 src/lua/fawkes/fsm/jumpstate.lua |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/lua/fawkes/fsm/jumpstate.lua b/src/lua/fawkes/fsm/jumpstate.lua
index b75471e..787e3b1 100644
--- a/src/lua/fawkes/fsm/jumpstate.lua
+++ b/src/lua/fawkes/fsm/jumpstate.lua
@@ -52,8 +52,8 @@ JumpState = { comment           = "",
 	      init              = State.init,
 	      exit              = State.exit,
 	      loop              = State.loop,
-	      reset             = State.reset,
-	      do_exit           = State.do_exit}
+	      reset             = State.reset}--,
+	      --do_exit           = State.do_exit}
 
 --- Create new jump state.
 -- @param o table with initializations for the object.
@@ -84,6 +84,7 @@ end
 -- executed for every state for derived states. 
 -- @param ... Any parameters, passed to the init() function.
 function JumpState:do_init(...)
+   self.starttime = fawkes.Time:new():in_msec()
    local rv = { self:try_transitions(true) }
    if next(rv) then return unpack(rv) end
    self:init(...)
@@ -94,6 +95,19 @@ function JumpState:do_init(...)
 end
 
 
+--- Execute exit routines.
+--
+-- at param ... Any parameters, passed to exit() function
+function JumpState:do_exit(...)
+   self:exit(...)
+   if self.cumulative_time == nil then
+      self.cumulative_time = 0
+   end
+   self.endtime=fawkes.Time:new():in_msec()
+   self.cumulative_time = self.cumulative_time+self.endtime-self.starttime
+   
+end
+
 --- Execute jump state loop.
 -- This will execute the loop and afterwards check if any jump condition
 -- of the registered transitions holds. Iff one holds the checks are immediately

- *commit* 053b3229aa7963e5c197aca4dec9ff2943e9d383 - - - - - - - - - -
Author:  Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
Date:    Fri Apr 15 13:27:00 2016 +0200
Subject: subskill_jumpstate.lua: Measuring time in states

 src/lua/skiller/subskill_jumpstate.lua |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/lua/skiller/subskill_jumpstate.lua b/src/lua/skiller/subskill_jumpstate.lua
index c468e7f..9c3c282 100644
--- a/src/lua/skiller/subskill_jumpstate.lua
+++ b/src/lua/skiller/subskill_jumpstate.lua
@@ -101,6 +101,10 @@ function SubSkillJumpState:new(o)
    setmetatable(self, JumpState)
    self.__index = self
 
+   o.starttime       = 0
+   o.enddtime        = 0
+   o.cumulative_time = 0
+
    o.skill_status  = skillstati.S_RUNNING
    --o.subskills     = o.subskills or {}
    o.transitions   = o.transitions or {}
@@ -222,7 +226,10 @@ end
 -- This resets any skills that have been added for this state and then executes
 -- the state's init() routine. Do not overwrite do_init(), rather implement init().
 function SubSkillJumpState:do_init()
+   
+   self.starttime = fawkes.Time:new():in_msec()
    -- Try preconditions
+
    local rv = { self:try_transitions(true) }
    if next(rv) then return unpack(rv) end
 
@@ -315,6 +322,9 @@ function SubSkillJumpState:do_exit()
       s[1].reset()
    end
    self:exit()
+   self.endtime=fawkes.Time:new():in_msec()
+   self.cumulative_time = self.cumulative_time+self.endtime-self.starttime
+   print_debug("[STATE] State: "..self.name..", init: "..self.starttime..", exit: "..self.endtime..", cumulative time: "..self.cumulative_time ) 
 end
 
 function SubSkillJumpState:skillstring(skill)
@@ -386,4 +396,5 @@ function SubSkillJumpState:reset()
    JumpState.reset(self)
    self:skill_reset()
    self.skill_status = skillstati.S_INACTIVE
+   self.cumulative_time =0
 end

- *commit* 16ac1f49ba873a306af3e8116648b3dd91da4f42 - - - - - - - - - -
Author:  Sebastian Schoenitz <sebastian.schoenitz at ima-zlw-ifu.rwth-aachen.de>
Date:    Fri Apr 15 13:39:31 2016 +0200
Subject: jumpstate.lua: Logging times via debug

 src/lua/fawkes/fsm/jumpstate.lua |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

_Diff for modified files_:
diff --git a/src/lua/fawkes/fsm/jumpstate.lua b/src/lua/fawkes/fsm/jumpstate.lua
index 787e3b1..04a0403 100644
--- a/src/lua/fawkes/fsm/jumpstate.lua
+++ b/src/lua/fawkes/fsm/jumpstate.lua
@@ -51,8 +51,8 @@ JumpState = { comment           = "",
 	      last_transition   = State.last_transition,
 	      init              = State.init,
 	      exit              = State.exit,
-	      loop              = State.loop,
-	      reset             = State.reset}--,
+	      loop              = State.loop}--,
+	      --reset             = State.reset}--,
 	      --do_exit           = State.do_exit}
 
 --- Create new jump state.
@@ -66,6 +66,12 @@ function JumpState:new(o)
    setmetatable(o, self)
    self.__index = self
 
+   --
+      o.starttime       = 0
+      o.enddtime        = 0
+      o.cumulative_time = 0
+   --
+   
    o.dotattr = o.dotattr or {}
    o.transitions = o.transitions or {}
    o.loops = o.loops or {}
@@ -76,6 +82,8 @@ function JumpState:new(o)
    assert(type(o.loops) == "table", "Loops for " .. o.name .. " not a table")
    assert(type(o.inits) == "table", "Inits for " .. o.name .. " not a table")
 
+
+
    return o
 end
 
@@ -99,13 +107,18 @@ end
 --
 -- at param ... Any parameters, passed to exit() function
 function JumpState:do_exit(...)
-   self:exit(...)
+   State.do_exit(self)
    if self.cumulative_time == nil then
       self.cumulative_time = 0
    end
    self.endtime=fawkes.Time:new():in_msec()
    self.cumulative_time = self.cumulative_time+self.endtime-self.starttime
-   
+   print_debug("[STATE] State: "..self.name..", init: "..self.starttime..", exit: "..self.endtime..", cumulative time: "..self.cumulative_time )
+end
+
+function JumpState:reset(...)
+	State.reset(self)
+	self.cumulative_time =0
 end
 
 --- Execute jump state loop.




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list