Changes have been pushed for the repository "fawkes.git".
(Fawkes Robotics Software Framework)

Clone:  g...@git.fawkesrobotics.org:fawkes.git
Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, timn/clips-executive-skill-id has been created
        at  ac4ed7c50a8e58c7300342d23da5ddffdcf9ebdc (commit)

http://git.fawkesrobotics.org/fawkes.git/timn/clips-executive-skill-id

- *Log* ---------------------------------------------------------------
commit ac4ed7c50a8e58c7300342d23da5ddffdcf9ebdc
Author:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
AuthorDate: Fri Apr 13 12:25:42 2018 +0200
Commit:     Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
CommitDate: Fri Apr 13 12:25:42 2018 +0200

    clips-executive: bijective mapping from plan-action to skill exec info
    
    Skills were only matched by skill name from plan action execution. This,
    however, may not be unique if the same skill is executed back-to-back
    mutliple times. This is another version of the typical "did not check
    message id" problem for skill execution.
    
    Fix by introducing a unique ID for skills during execution which is
    returned by (skill-call). Use only this ID to match skill execution
    info.
    
    Along the way, fix an adjacent issue that goal and plan IDs were not
    matched for plan actions. Theoretically, if multiple plans had been
    asserted, a skill may have triggered status updates to the wrong action.

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

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


- *Summary* -----------------------------------------------------------


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

- *commit* ac4ed7c50a8e58c7300342d23da5ddffdcf9ebdc - - - - - - - - - -
Author:  Tim Niemueller <niemuel...@kbsg.rwth-aachen.de>
Date:    Fri Apr 13 12:25:42 2018 +0200
Subject: clips-executive: bijective mapping from plan-action to skill exec info

 .../clips-executive/clips/skills-actions.clp       |   35 +++++++++++--------
 src/plugins/clips-executive/clips/skills.clp       |   17 +++++++--
 2 files changed, 33 insertions(+), 19 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/clips-executive/clips/skills-actions.clp 
b/src/plugins/clips-executive/clips/skills-actions.clp
index f770ace..a6a4706 100644
--- a/src/plugins/clips-executive/clips/skills-actions.clp
+++ b/src/plugins/clips-executive/clips/skills-actions.clp
@@ -3,14 +3,17 @@
 ;  skills-actions.clp - CLIPS executive - execute skill actions
 ;
 ;  Created: Wed Sep 20 15:46:48 2017
-;  Copyright  2017  Tim Niemueller [www.niemueller.de]
+;  Copyright  2017-2018  Tim Niemueller [www.niemueller.de]
 ;  Licensed under GPLv2+ license, cf. LICENSE file
 ;---------------------------------------------------------------------------
 
 (deftemplate skill-action-execinfo
+       (slot goal-id (type SYMBOL))
+       (slot plan-id (type SYMBOL))
        (slot action-id (type INTEGER))
        ;(slot channel (type INTEGER))
        (slot skill-name (type SYMBOL))
+       (slot skill-id (type SYMBOL))
        (multislot skill-args)
 )
 
@@ -30,7 +33,7 @@
 )
 
 (defrule skill-action-start
-       ?pa <- (plan-action (plan-id ?plan-id) (id ?id) (status PENDING)
+       ?pa <- (plan-action (goal-id ?goal-id) (plan-id ?plan-id) (id ?id) 
(status PENDING)
                       (action-name ?action-name) (executable TRUE)
                       (param-names $?params)
                       (param-values $?param-values))
@@ -38,29 +41,31 @@
        (not (skill-action-execinfo))
        (skiller-control (acquired TRUE))
        =>
-       (skill-call ?action-name ?params ?param-values)
+       (bind ?skill-id (skill-call ?action-name ?params ?param-values))
        (modify ?pa (status WAITING))
        (bind ?args (create$))
        (loop-for-count (?i (length$ ?params))
                (bind ?args (append$ ?args (nth$ ?i ?params) (nth$ ?i 
?param-values)))
        )
-       (assert (skill-action-execinfo (action-id ?id) (skill-name 
?action-name) (skill-args ?args)))
+       (assert (skill-action-execinfo (goal-id ?goal-id) (plan-id ?plan-id) 
(action-id ?id)
+                                                                               
                                                 (skill-id ?skill-id) 
(skill-name ?action-name) (skill-args ?args)))
 )
 
 (defrule skill-action-running
-       ?pa <- (plan-action (plan-id ?plan-id) (id ?id) (status WAITING)
-                                                                               
        (action-name ?action-name))
-       (skill (name ?action-name) (status S_RUNNING))
+       ?pa <- (plan-action (goal-id ?goal-id) (plan-id ?plan-id) (id ?id) 
(status WAITING))
+       ?pe <- (skill-action-execinfo (goal-id ?goal-id) (plan-id ?plan-id)
+                                                                               
                                                (action-id ?id) (skill-id 
?skill-id))
+       (skill (skill-id ?skill-id) (status S_RUNNING))
        =>
        (printout t "Action " ?action-name " is running" crlf)
        (modify ?pa (status RUNNING))
 )
 
 (defrule skill-action-final
-       ?pe <- (skill-action-execinfo (action-id ?id))
-       ?pa <- (plan-action (plan-id ?plan-id) (id ?id)
-                                                                               
        (action-name ?action-name))
-       ?sf <- (skill (name ?action-name) (status S_FINAL))
+       ?pa <- (plan-action (goal-id ?goal-id) (plan-id ?plan-id) (id ?id) 
(status WAITING))
+       ?pe <- (skill-action-execinfo (goal-id ?goal-id) (plan-id ?plan-id)
+                                                                               
                                                (action-id ?id) (skill-id 
?skill-id))
+       ?sf <- (skill (skill-id ?skill-id) (status S_FINAL))
        =>
        (printout t "Execution of " ?action-name " completed successfully" crlf)
        (modify ?pa (status EXECUTION-SUCCEEDED))
@@ -68,10 +73,10 @@
 )
 
 (defrule skill-action-failed
-       ?pe <- (skill-action-execinfo (action-id ?id))
-       ?pa <- (plan-action (plan-id ?plan-id) (id ?id)
-                                                                               
        (action-name ?action-name))
-       ?sf <- (skill (name ?action-name) (status S_FAILED) (error-msg ?error))
+       ?pa <- (plan-action (goal-id ?goal-id) (plan-id ?plan-id) (id ?id) 
(status WAITING))
+       ?pe <- (skill-action-execinfo (goal-id ?goal-id) (plan-id ?plan-id)
+                                                                               
                                                (action-id ?id) (skill-id 
?skill-id))
+       ?sf <- (skill (skill-id ?skill-id) (status S_FAILED) (error-msg ?error))
        =>
        (printout warn "Execution of " ?action-name " FAILED (" ?error ")" crlf)
        (modify ?pa (status EXECUTION-FAILED))
diff --git a/src/plugins/clips-executive/clips/skills.clp 
b/src/plugins/clips-executive/clips/skills.clp
index 9374589..cc82f66 100644
--- a/src/plugins/clips-executive/clips/skills.clp
+++ b/src/plugins/clips-executive/clips/skills.clp
@@ -13,6 +13,11 @@
 )
 
 (deftemplate skill
+       ; Unique ID, meaningful only in the realm of this skill executor
+       ; and for components that interface with it.
+       ; It is guaranteed to be unique, also for the case when executin the
+       ; exact same skill a second time.
+       (slot id (type SYMBOL))
   (slot name (type SYMBOL))
   (slot status (type SYMBOL) (allowed-values S_IDLE S_RUNNING S_FINAL 
S_FAILED))
   (slot error-msg (type STRING))
@@ -74,10 +79,12 @@
        (bind ?sks (map-action-skill ?name ?param-names ?param-values))
        (printout logwarn "sks='" ?sks "'" crlf)
 
+       (bind ?id UNKNOWN)
        (if (eq ?sks "")
-       then
-               (assert (skill (name (sym-cat ?name)) (status S_FAILED) 
(start-time (now))
-                                                                        
(error-msg (str-cat "Failed to convert action '" ?name "' to skill string"))))
+                       then
+               (bind ?id (sym-cat ?name (gensym*)))
+               (assert (skill (id ?id) (name (sym-cat ?name)) (status 
S_FAILED) (start-time (now))
+                       (error-msg (str-cat "Failed to convert action '" ?name 
"' to skill string"))))
        else
                (bind ?m (blackboard-create-msg "SkillerInterface::Skiller" 
"ExecSkillMessage"))
                (blackboard-set-msg-field ?m "skill_string" ?sks)
@@ -85,9 +92,11 @@
                (printout logwarn "Calling skill '" ?sks "'" crlf)
                (bind ?msgid (blackboard-send-msg ?m))
                (bind ?status (if (eq ?msgid 0) then S_FAILED else S_IDLE))
-               (assert (skill (name (sym-cat ?name)) (skill-string ?sks)
+               (bind ?id (sym-cat ?name "-" ?msgid))
+               (assert (skill (id ?id) (name (sym-cat ?name)) (skill-string 
?sks)
                                                                         
(status ?status) (msgid ?msgid) (start-time (now))))
        )
+       (return ?id)
 )
 
 (defrule skill-control-acquire




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org
_______________________________________________
fawkes-commits mailing list
fawkes-commits@lists.kbsg.rwth-aachen.de
https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits

Reply via email to