From 6fce86454dc249a99948bfe784baf45895fc1332 Mon Sep 17 00:00:00 2001 From: Dagim Sisay Date: Thu, 17 Jan 2019 11:50:50 +0300 Subject: [PATCH] TinyCog side of atomspace#1989 --- behavior/behavior.scm | 2 +- behavior/functions.scm | 12 ++++++------ dr-roboto/dr-roboto.cpp.in | 38 +++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/behavior/behavior.scm b/behavior/behavior.scm index 52320dd..96fa20d 100644 --- a/behavior/behavior.scm +++ b/behavior/behavior.scm @@ -112,7 +112,7 @@ (cog-new-stv 1 1)))) ; set some deault values -(cog-set-value! Aey Apos_h (FloatValue 0 0)) +(cog-set-value! Aey Apos_h (FloatSeqValue 0 0)) ; look at a salient point (define-public (look-salient-point atom) diff --git a/behavior/functions.scm b/behavior/functions.scm index b712387..3b63030 100644 --- a/behavior/functions.scm +++ b/behavior/functions.scm @@ -16,14 +16,14 @@ ;; Value ;; PredicateNode "emotion" ;; ConceptNode "face_0" -;; StringValue "angry" +;; StringSeqValue "angry" ;; ;; The same thing for the other sensors. ;; ;; The "sense" and "rate" nodes are used to set the delay for ;; each loop of the sensors. Setting the following delays each ;; sensor iteration by 1000 us -;; (cog-set-value sen_h rate_h (FloatValue 1000)) +;; (cog-set-value sen_h rate_h (FloatSeqValue 1000)) (define-public Afs (ConceptNode "face")) (define-public Asm (PredicateNode "smile")) @@ -40,8 +40,8 @@ ; some default values (define-public IMAGE_WIDTH 320) (define-public IMAGE_HEIGHT 240) -(cog-set-value! Afs Anof (FloatValue 0)) -(cog-set-value! Aey Apos_h (FloatValue 0 0)) +(cog-set-value! Afs Anof (FloatSeqValue 0)) +(cog-set-value! Aey Apos_h (FloatSeqValue 0 0)) ; A function which always returns false (define-public (func-false) @@ -82,8 +82,8 @@ (define-public (wordlist-to-str wrdlst) (string-concatenate (map append-space (map cog-name (wrdlst))))) -; function to convert a FloatValue to exact number -; only the first of the FloatValue array +; function to convert a FloatSeqValue to exact number +; only the first of the FloatSeqValue array (define-public (cog-value->exact cv) (if (cog-value? cv) (inexact->exact (car (cog-value->list cv))) diff --git a/dr-roboto/dr-roboto.cpp.in b/dr-roboto/dr-roboto.cpp.in index 256c8a4..b476eba 100644 --- a/dr-roboto/dr-roboto.cpp.in +++ b/dr-roboto/dr-roboto.cpp.in @@ -48,9 +48,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include @@ -166,7 +166,7 @@ void DrRoboto::sensor_loop(DrRoboto *dr) Handle pos_h = dr->_as->add_node(CONCEPT_NODE, "position"); Handle sen_h = dr->_as->add_node(CONCEPT_NODE, "sense"); Handle rate_h = dr->_as->add_node(CONCEPT_NODE, "rate"); - //sen_h->setValue(rate_h, createFloatValue(1000)); //u-secs to delay sensor + //sen_h->setValue(rate_h, createFloatSeqValue(1000)); //u-secs to delay sensor ValuePtr pap; @@ -186,30 +186,30 @@ void DrRoboto::sensor_loop(DrRoboto *dr) Value ConceptNode "position" ConceptNode "face_x" - FloatValue X Y + FloatSeqValue X Y */ faces = dr->fcd.Transform(he); for(idx = 0; idx < faces.size(); idx++) { str = "face_" + std::to_string(idx+1); h = dr->_as->add_node(CONCEPT_NODE, str.c_str()); - pap = createFloatValue(std::vector({(double) faces[idx].x + faces[idx].width/2, + pap = createFloatSeqValue(std::vector({(double) faces[idx].x + faces[idx].width/2, (double) faces[idx].y + faces[idx].height/2})); h->setValue(pos_h, pap); img = he(faces[idx]); smile = dr->smd.Transform(img); //only check on the smaller face region if(!smile.empty()) - pap = createFloatValue(1.0); + pap = createFloatSeqValue(1.0); else - pap = createFloatValue(0.0); + pap = createFloatSeqValue(0.0); h->setValue(sm, pap); /* ^ this is Valuation PredicateNode "smile" ConceptNode "face_x" - FloatValue x.x + FloatSeqValue x.x */ #ifdef _DEBUG_ //XXX REMOVE WHEN DONE @@ -235,11 +235,11 @@ void DrRoboto::sensor_loop(DrRoboto *dr) Value PredicateNode "emotion" ConceptNode "face_x" - StringValue "emotion_x" + StringSeqValue "emotion_x" */ if(dr->ferpc.detect_emotion(img, emo_preds, emo_boxes)) { if(emo_preds.size() == 1) { - pap = createStringValue(emo_preds[0]); + pap = createStringSeqValue(emo_preds[0]); h->setValue(em, pap); #ifdef _DEBUG_ //XXX REMOVE WHEN DONE cv::putText(_dbg_img, emo_preds[0], @@ -259,20 +259,20 @@ void DrRoboto::sensor_loop(DrRoboto *dr) Value ConceptNode "face" PredicateNode "number_of" - FloatValue X + FloatSeqValue X */ - fs->setValue(nof, createFloatValue((double)faces.size())); + fs->setValue(nof, createFloatSeqValue((double)faces.size())); /* salient point Valuation PredicateNode "look" ConceptNode "eyes" - FloatValue X Y + FloatSeqValue X Y */ cent = dr->sal_d.sal_point(gr, gr); - pap = createFloatValue(std::vector({(double)cent.x, (double)cent.y})); + pap = createFloatSeqValue(std::vector({(double)cent.x, (double)cent.y})); ey->setValue(lk, pap); #ifdef _DEBUG_ //XXX REMOVE WHEN DONE @@ -286,13 +286,13 @@ void DrRoboto::sensor_loop(DrRoboto *dr) Valuation PredicateNode "position" ConceptNode "hand" - FloatValue X Y + FloatSeqValue X Y ** finger count ** XXX not sure if this is the right way Valuation ConceptNode "fingers" ConceptNode "hand_x" - FloatValue X + FloatSeqValue X */ cv::threshold(he, he, 70, 255, CV_THRESH_BINARY_INV | CV_THRESH_OTSU); hands = dr->dh.Transform(he); @@ -304,12 +304,12 @@ void DrRoboto::sensor_loop(DrRoboto *dr) str = "hand_" + std::to_string(idx); h = dr->_as->add_node(CONCEPT_NODE, str.c_str()); - pap = createFloatValue(std::vector({ + pap = createFloatSeqValue(std::vector({ (double)hands[idx].x+(hands[idx].width/2), (double)hands[idx].y+(hands[idx].height/2)})); h->setValue(pos_h, pap); - pap = createFloatValue((float)dr->fc.num_fingers(img)); + pap = createFloatSeqValue((float)dr->fc.num_fingers(img)); h->setValue(fi, pap); #ifdef _DEBUG_ //XXX REMOVE WHEN DONE