Skip to content

Commit 39fb7f9

Browse files
committed
some minor fixes
1 parent 7f260fc commit 39fb7f9

4 files changed

Lines changed: 24 additions & 6 deletions

File tree

act/cmd_einstein.scm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
(ice-9 regex)
1010
(json))
1111

12+
;(include-from-path "behavior/functions.scm")
1213

1314
; XXX there should be error checks here... just have to make sure the robot has its
1415
; port 8080 open before starting this script. Don't know how to do the error checks
@@ -151,15 +152,15 @@
151152
(define-public (act-pan-head POS)
152153
(if (bn-zero-one? POS)
153154
(begin
154-
(send-to-einstein (format #f "<MO=HT,~f,0.5>" POS))
155+
(send-to-einstein (format #f "<MO=HT,~f,0.5>" (format #f "~4f" POS)))
155156
(stv 1 1))
156157
(stv 0 1)))
157158

158159
; tilt the head to a given point
159160
(define-public (act-tilt-head POS)
160161
(if (bn-zero-one? POS)
161162
(begin
162-
(send-to-einstein (format #f "<MO=HN,~f,0.5>" POS))
163+
(send-to-einstein (format #f "<MO=HN,~f,0.5>" (format #f "~4f" POS)))
163164
(stv 1 1))
164165
(stv 0 1)))
165166

@@ -188,4 +189,4 @@
188189
; go to sleep. When a speech or intentional command is to be sent,
189190
; do-random-actions should be set to false so that no interfering cmnds
190191
; are sent during that time and then reenabled again.
191-
(call-with-new-thread random-cmds)
192+
;(call-with-new-thread random-cmds)

behavior/behavior.scm

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88
;; load ghost rules
99
(begin (display "Loading Ghost Scripts...") (newline))
10-
(ghost-parse-file (string-append TOPDIR "/ghost/concepts_1.ghost"))
10+
;(ghost-parse-file (string-append TOPDIR "/ghost/concepts_1.ghost"))
1111
(ghost-parse-file (string-append TOPDIR "/ghost/character_1.ghost"))
1212
(ghost-parse-file (string-append TOPDIR "/ghost/intro1.ghost"))
13+
(ghost-parse-file (string-append TOPDIR "/ghost/chitchat.ghost"))
1314
(begin (display "Done Loading Ghost Scripts.") (newline))
1415

1516

@@ -22,6 +23,7 @@
2223

2324
; check if a face in sight
2425
(define-public (sense-any-face? atom)
26+
(begin (display "** sensing for a face **") (newline))
2527
(set! no_faces (cog-value->exact (cog-value Afs Anof)))
2628
(if (> no_faces 0)
2729
(cog-new-stv 1 1)
@@ -32,13 +34,15 @@
3234
; is sensed. The sensors would set a floatvalue with
3335
; the arg node as the atom and the (PredicateNode "number_of") as key
3436
(define-public (sense-any? atom)
37+
(begin (display "** generic sense any? **") (newline))
3538
(set! no_faces (cog-value->exact (cog-value atom Anof)))
3639
(if (> no_faces 0)
3740
(cog-new-stv 1 1)
3841
(cog-new-stv 0 1)))
3942

4043

4144
(define-public (sense-find-smiling-face)
45+
(begin (display "** sensing for smiling face **") (newline))
4246
(set! smiling_face_idx 0)
4347
(if (> no_faces 0)
4448
(do ((i 1 (+ 1 i))) ((> i no_faces))
@@ -47,6 +51,7 @@
4751

4852
; set the index of a non neutral face to nonneutral-face-idx
4953
(define-public (sense-find-emotional-face)
54+
(begin (display "** sensing for an emotional face **") (newline))
5055
(set! nonneutral-face-idx 0)
5156
(if (> no_faces 0)
5257
(do ((i 2 (1+ i))) ((> i no_faces))
@@ -56,6 +61,7 @@
5661

5762
; before looking at face check if any faces first and return false if none
5863
(define-public (look-face atom)
64+
(begin (display "** executing behave find face to look at **") (newline))
5965
(cog-evaluate! behave-find-face-to-look))
6066

6167

@@ -66,6 +72,7 @@
6672
; look at a single face
6773
; first check if only one face in view
6874
(define-public (look-single-face atom)
75+
(begin (display "**> look single face **") (newline))
6976
(if (eq? no_faces 1)
7077
(begin
7178
(act-face-a-point (cog-value->list (cog-value (ConceptNode "face_1") Apos_h)))
@@ -75,6 +82,7 @@
7582

7683
; face a smiling face if any
7784
(define-public (look-smiling-face atom)
85+
(begin (display "**> look smiling face **") (newline))
7886
(sense-find-smiling-face)
7987
(if (eq? smiling_face_idx 0) ; if smiling_face_idx is zero, there is no smiling face
8088
(cog-new-stv 0 1) ; so return failure
@@ -90,6 +98,7 @@
9098
; in general any face which isn't neutral
9199
; set something here to aid a ghost gambit in saying "why the _____ face"
92100
(define-public (look-emotional-face atom)
101+
(begin (display "**> look emotional face **") (newline))
93102
(sense-find-emotional-face)
94103
(if (eq? nonneutral-face-idx 0)
95104
(cog-new-stv 0 1)
@@ -102,6 +111,7 @@
102111

103112
; face one of the neutral faces just at random
104113
(define-public (look-random-face atom)
114+
(begin (display "**> look random face **") (newline))
105115
(if (eq? no_faces 0)
106116
(cog-new-stv 0 1)
107117
(begin
@@ -116,6 +126,7 @@
116126

117127
; look at a salient point
118128
(define-public (look-salient-point atom)
129+
(begin (display "**> look at salient point **") (newline))
119130
(begin
120131
(act-face-a-point (cog-value->list (cog-value Aey Apos_h)))
121132
(cog-new-stv 1 1)))
@@ -159,5 +170,11 @@
159170
(GroundedPredicateNode "scm: look-salient-point")
160171
(PredicateNode "look"))))
161172

173+
(define-public (oc-bt)
174+
(while #t
175+
(begin (display "** executing main BT **") (newline))
176+
(cog-evaluate! behave-looking)
177+
(usleep 5000000)))
162178

163-
(cog-evaluate! behave-looking)
179+
180+
(call-with-new-thread oc-bt)

behavior/functions.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080

8181
; Convert list of WordNode to string
8282
(define-public (wordlist-to-str wrdlst)
83-
(string-concatenate (map append-space (map cog-name (wrdlst)))))
83+
(string-concatenate (map append-space (map cog-name wrdlst))))
8484

8585
; function to convert a FloatValue to exact number
8686
; only the first of the FloatValue array
File renamed without changes.

0 commit comments

Comments
 (0)