Skip to content

Commit 9cb6429

Browse files
committed
Demo face smile detection and chat
1 parent 10c5a30 commit 9cb6429

6 files changed

Lines changed: 41 additions & 5 deletions

File tree

behavior/behavior.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@
5858

5959

6060
;; Run dynamic psi
61-
(psi-updater-run)
61+
;(psi-updater-run)

behavior/demo.top

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ u: (me name be _*) $name='_0 Hi '_0
1414

1515
u: (what be me name $name) Your name is $name
1616

17-
u: (you hate human) no. you are very interesting. Do you hate robotos?
17+
u: (you hate humans) no. you are very interesting. Do you hate robots?
1818
a: (yes) I am sure you are going to like me though
1919
a: (no) We will get along fine
2020

behavior/updater.scm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@
6161
)
6262
)
6363

64+
#|
6465
; Finally send text output to stt when there is one
6566
; Note: This code is only for demo (stt input should be read from port)
66-
67+
6768
(set! ghost-result (ghost-get-result))
6869
(for-each (lambda (a)
6970
(set! txt-str (string-trim (string-append txt-str " " (cog-name a))))
@@ -79,8 +80,10 @@
7980
)
8081

8182
)
83+
|#
8284

8385
)
86+
(usleep 10000)
8487
)
8588

8689
)

dr-roboto.scm

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,34 @@
3232

3333
; load scratch interface
3434
(include "scratch/scratch.scm")
35+
36+
37+
(define txt-str-prev "")
38+
39+
(while #t
40+
(let ((txt-str "")
41+
(ghost-result '()))
42+
43+
44+
; Finally send text output to stt when there is one
45+
; Note: This code is only for demo (stt input should be read from port)
46+
47+
(set! ghost-result (ghost-get-result))
48+
(for-each (lambda (a)
49+
(set! txt-str (string-trim (string-append txt-str " " (cog-name a))))
50+
)ghost-result
51+
)
52+
53+
(if (equal? txt-str txt-str-prev)
54+
(continue)
55+
(begin
56+
(act-say txt-str)
57+
(set! txt-str-prev txt-str)
58+
)
59+
60+
)
61+
62+
)
63+
(usleep 100000)
64+
65+
)

dr-roboto/dr-roboto.cpp.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const char *face_detect()
8686
std::to_string(faces[i].height) + ";";
8787
//ret += ";";
8888
//cv::imshow("image", frame);
89+
cv::imwrite("face.jpg", frame);
8990
return ret.c_str();
9091
}
9192

@@ -111,8 +112,8 @@ const char *face_smile_detect()
111112
}
112113
//ret += ";";
113114
//cv::imshow("image", frame);
114-
std::cout<<ret<<std::endl;
115-
cv::imwrite("face_smile.jpg", frame);
115+
//std::cout<<ret<<std::endl;
116+
//cv::imwrite("face_smile.jpg", frame);
116117
return ret.c_str();
117118
}
118119

socket/socket.scm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
(close client))
121121
)
122122
)
123+
(usleep 100000)
123124
)
124125
)
125126
)

0 commit comments

Comments
 (0)