[Fawkes Git] branch/timn/clips-bb-inf: created (0.5.0-3081-g0e8e3e2)

Tim Niemueller niemueller at kbsg.rwth-aachen.de
Tue Feb 23 16:21:24 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, timn/clips-bb-inf has been created
        at  0e8e3e2b717320526c870c678a053ed0227569a7 (commit)

http://git.fawkesrobotics.org/fawkes.git/timn/clips-bb-inf

- *Log* ---------------------------------------------------------------
commit 0e8e3e2b717320526c870c678a053ed0227569a7
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Tue Feb 23 16:20:03 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Tue Feb 23 16:20:03 2016 +0100

    clips: fix blackboard reading for +/- inf values
    
    CLIPS cannot actually handle inf/-inf values. Work around by setting
    really small or really large numbers in that case.

http://git.fawkesrobotics.org/fawkes.git/commit/0e8e3e2
http://trac.fawkesrobotics.org/changeset/0e8e3e2

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


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


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

- *commit* 0e8e3e2b717320526c870c678a053ed0227569a7 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Tue Feb 23 16:20:03 2016 +0100
Subject: clips: fix blackboard reading for +/- inf values

 src/plugins/clips/feature_blackboard.cpp |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/clips/feature_blackboard.cpp b/src/plugins/clips/feature_blackboard.cpp
index ae35305..2d5aa07 100644
--- a/src/plugins/clips/feature_blackboard.cpp
+++ b/src/plugins/clips/feature_blackboard.cpp
@@ -506,6 +506,17 @@ BlackboardCLIPSFeature::clips_blackboard_read(std::string env_name)
 	    while ((pos = value.find(",")) != std::string::npos) {
 	      value = value.erase(pos, 1);
 	    }
+
+	    if (f.get_type() == IFT_FLOAT || f.get_type() == IFT_DOUBLE) {
+		    std::string::size_type pos;
+		    while ((pos = value.find("-inf")) != std::string::npos) {
+			    value = value.replace(pos, 4, std::to_string(std::numeric_limits<double>::min()));
+		    }
+		    while ((pos = value.find("inf")) != std::string::npos) {
+			    value = value.replace(pos, 3, std::to_string(std::numeric_limits<double>::max()));
+		    }
+	    }
+
 	  }
 	  fact += std::string(" (") + f.get_name() + " " + value + ")";
 	}




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list