|
12 | 12 | ; HOWTO: |
13 | 13 | ; ------ |
14 | 14 | ; Run the main loop: |
15 | | -; (behavior-tree-run) |
| 15 | +; (run) |
16 | 16 | ; Pause the main loop: |
17 | | -; (behavior-tree-halt) |
| 17 | +; (halt) |
18 | 18 | ; |
19 | 19 | ; TODO: |
20 | 20 | ; ----- |
21 | | -; XXX This needs a major redesign, to NOT use behavior trees at the top |
22 | | -; level, but instead to provide a library of suitable actions that can |
23 | | -; be searched over, and then performed when a given situation applies. |
24 | | -; That is, given a certain state vector (typically, a subset of the |
25 | | -; current state), the library is searched to see if there is a behavior |
26 | | -; sequence that can be applied to this situation. If there is no such |
27 | | -; explicit match, then the fuzzy matcher should be employed to find |
28 | | -; something that is at least close. If nothing close is found, then |
29 | | -; either the concept blending code, or a hack of the MOSES knob-turning |
30 | | -; and genetic cross-over code should be used to create new quasi-random |
| 21 | +; The current OpenPsi framework allows much more general and flexible |
| 22 | +; rules than what are presented below; this geneality should be made |
| 23 | +; use of. |
| 24 | +; |
| 25 | +; A general OpenPsi rule has the form of if(context) then take(action); |
| 26 | +; these can contain variables, adn can also be classed into different |
| 27 | +; groups based on the demands that they are fulfilling. |
| 28 | +; |
| 29 | +; The content below consits entirely of actions to nbe taken; the |
| 30 | +; contexts are in the `self-model.scm` file. The structure of the |
| 31 | +; conexts is fairly rigid; these could probably be loosened to a |
| 32 | +; large degree. |
| 33 | +; |
| 34 | +; The OpenPsi engine could be (should be?) updated to perform fuzzy |
| 35 | +; matching on the contexts, to find close or similar contexts, if no |
| 36 | +; one exact match can be made. If nothing close is found, then either |
| 37 | +; the concept blending code, or a hack of the MOSES knob-turning and |
| 38 | +; genetic cross-over code should be used to create new quasi-random |
31 | 39 | ; performance sequences from a bag of likely matches. |
32 | 40 | ; |
33 | 41 | ; Unit testing: |
|
719 | 727 | )) |
720 | 728 | (TrueLink) |
721 | 729 | )) |
| 730 | + |
722 | 731 | (DefineLink |
723 | 732 | (DefinedPredicate "Keep alive") |
724 | 733 | (SequentialAnd |
|
740 | 749 | )) |
741 | 750 | (TrueLink) |
742 | 751 | )) |
743 | | -;; ------------------------------------------------------------------ |
744 | | -;; Main loop. Uses tail recursion optimization to form the loop. |
745 | | -(DefineLink |
746 | | - (DefinedPredicate "main loop") |
747 | | - (SatisfactionLink |
748 | | - (SequentialAnd |
749 | | - (SequentialOr |
750 | | - (DefinedPredicate "Skip Interaction?") |
751 | | - |
752 | | - (SequentialAnd |
753 | | - (DefinedPredicate "Someone requests interaction?") |
754 | | - (DefinedPredicate "Interaction requested action")) |
755 | | - |
756 | | - (SequentialAnd |
757 | | - (DefinedPredicate "Did someone arrive?") |
758 | | - (DefinedPredicate "New arrival sequence")) |
759 | | - |
760 | | - (SequentialAnd |
761 | | - (DefinedPredicate "Did someone leave?") |
762 | | - (DefinedPredicate "Someone left action")) |
763 | | - |
764 | | - ; True, if there is anyone visible. |
765 | | - (SequentialAnd |
766 | | - (DefinedPredicate "Someone visible?") |
767 | | - (DefinedPredicate "Interact with people")) |
768 | | - |
769 | | - (DefinedPredicate "Nothing is happening") |
770 | | - (True)) |
771 | | - |
772 | | - ;; XXX FIXME chatbot is disengaged from everything else. |
773 | | - ;; The room can be empty, the head is bored or even asleep, |
774 | | - ;; but the chatbot is still smiling and yabbering. |
775 | | - ;; If interaction is turned-off need keep alive gestures |
776 | | - (SequentialOr |
777 | | - ; If the TTS vocalization started (chatbot started talking) ... |
778 | | - (SequentialAnd |
779 | | - (DefinedPredicate "chatbot started talking?") |
780 | | - (DefinedPredicate "Speech started")) |
781 | | - |
782 | | - ; If the chatbot currently talking ... |
783 | | - (SequentialAnd |
784 | | - (DefinedPredicate "chatbot is talking?") |
785 | | - (DefinedPredicate "Speech ongoing")) |
786 | | - |
787 | | - ; If the chatbot stopped talking ... |
788 | | - (SequentialAnd |
789 | | - (DefinedPredicate "chatbot stopped talking?") |
790 | | - (DefinedPredicate "Speech ended")) |
791 | | - |
792 | | - (SequentialAnd |
793 | | - (DefinedPredicate "chatbot started listening?") |
794 | | - (DefinedPredicate "Listening started")) |
795 | | - |
796 | | - ; If the chatbot stopped talking ... |
797 | | - (SequentialAnd |
798 | | - (DefinedPredicate "chatbot is listening?") |
799 | | - (DefinedPredicate "Listening ongoing")) |
800 | | - |
801 | | - ; If the chatbot stopped talking ... |
802 | | - (SequentialAnd |
803 | | - (DefinedPredicate "chatbot stopped listening?") |
804 | | - (DefinedPredicate "Listening ended")) |
805 | | - |
806 | | - (SequentialAnd |
807 | | - (DefinedPredicate "Skip Interaction?") |
808 | | - (DefinedPredicate "Keep alive")) |
809 | | - |
810 | | - (True) |
811 | | - ) |
812 | | - |
813 | | - ; If ROS is dead, or the continue flag not set, then stop |
814 | | - ; running the behavior loop. |
815 | | - (DefinedPredicate "Continue running loop?") |
816 | | - (DefinedPredicate "ROS is running?") |
817 | | - |
818 | | - ;; Call self -- tail-recurse. |
819 | | - (DefinedPredicate "main loop") |
820 | | - ))) |
821 | 752 |
|
822 | 753 | ; ---------------------------------------------------------------------- |
0 commit comments