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, thofmann/tabletop-obj has been updated to fec1addfb17b3643a6ea33a5d80f7b586675c1f9 (commit) via f039f994365e886219c3f67db8a20005197f683d (commit) from fda8d482c7815da8ab269bbc1a08c341156de4a6 (commit) http://git.fawkesrobotics.org/fawkes.git/thofmann/tabletop-obj Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - *Log* --------------------------------------------------------------- commit f039f994365e886219c3f67db8a20005197f683d Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> AuthorDate: Fri Jul 11 17:40:22 2014 +0200 Commit: Till Hofmann <hofm...@kbsg.rwth-aachen.de> CommitDate: Fri Jul 11 17:40:22 2014 +0200 tabletop-switch: add config flag for initial switch state Setting the config flag /perception/tabletop-objects/initial_state to false means all tabletop object plugins are disabled when the tabletop-switch plugin is loaded. This is useful in cases where the plugins should be loaded but at first disabled. http://git.fawkesrobotics.org/fawkes.git/commit/f039f99 http://trac.fawkesrobotics.org/changeset/f039f99 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - commit fec1addfb17b3643a6ea33a5d80f7b586675c1f9 Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> AuthorDate: Mon Aug 11 15:47:20 2014 +0200 Commit: Till Hofmann <hofm...@kbsg.rwth-aachen.de> CommitDate: Mon Aug 11 15:47:20 2014 +0200 perception: always set visibility to false if plugin is disabled Until now, all the perception plugins didn't set visibility to false (<0) if they were disabled. This can lead to problems with other components which enable the plugin and immediately read (outdated) blackboard data. Therefore, always set the visibility to false if the plugin is disabled. Note that the positions are not updated (and thus still accessible through the blackboard interface). http://git.fawkesrobotics.org/fawkes.git/commit/fec1add http://trac.fawkesrobotics.org/changeset/fec1add - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *Summary* ----------------------------------------------------------- .../object-detection/object_detection_thread.cpp | 3 ++ .../object-fitting/object_fitting_thread.cpp | 3 ++ .../object-tracking/object_tracking_thread.cpp | 4 ++ .../tabletop_detection_thread.cpp | 1 + .../tabletop-switch/tabletop_switch_thread.cpp | 38 ++++++++++++++----- .../tabletop-switch/tabletop_switch_thread.h | 9 +++++ 6 files changed, 48 insertions(+), 10 deletions(-) - *Diffs* ------------------------------------------------------------- - *commit* f039f994365e886219c3f67db8a20005197f683d - - - - - - - - - - Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> Date: Fri Jul 11 17:40:22 2014 +0200 Subject: tabletop-switch: add config flag for initial switch state .../tabletop-switch/tabletop_switch_thread.cpp | 38 ++++++++++++++----- .../tabletop-switch/tabletop_switch_thread.h | 9 +++++ 2 files changed, 37 insertions(+), 10 deletions(-) _Diff for modified files_: diff --git a/src/plugins/perception/tabletop-switch/tabletop_switch_thread.cpp b/src/plugins/perception/tabletop-switch/tabletop_switch_thread.cpp index ccbda85..02e1b78 100644 --- a/src/plugins/perception/tabletop-switch/tabletop_switch_thread.cpp +++ b/src/plugins/perception/tabletop-switch/tabletop_switch_thread.cpp @@ -28,6 +28,8 @@ using namespace fawkes; using namespace std; +#define CFG_PREFIX "/perception/tabletop-objects/" + /** @class TabletopSwitchThread "tabletop_switch_thread.h" * Thread to switch on/off tabletop plugins * @author Till Hofmann @@ -43,6 +45,10 @@ TabletopSwitchThread::TabletopSwitchThread() void TabletopSwitchThread::init() { + cfg_initial_state_ = true; + try { + cfg_initial_state_ = config->get_bool(CFG_PREFIX"initial_state"); + } catch (Exception &e) { } // ignore, use default try { switch_if_ = blackboard->open_for_writing<SwitchInterface>("tabletop-objects"); tabletop_switch_ifs_ = blackboard->open_multiple_for_reading<SwitchInterface>("object*"); @@ -74,6 +80,14 @@ TabletopSwitchThread::finalize() } } + +void +TabletopSwitchThread::once() +{ + logger->log_debug(name(), "Initializing all plugins to %d", cfg_initial_state_); + msg_all_interfaces(cfg_initial_state_); +} + void TabletopSwitchThread::loop() { @@ -96,16 +110,20 @@ TabletopSwitchThread::loop() } if (last_switch_state != switch_if_->is_enabled()) { - for (list<SwitchInterface *>::iterator it = tabletop_switch_ifs_.begin(); it != tabletop_switch_ifs_.end(); it++) { - Message *msg; - if (switch_if_->is_enabled()) { -// logger->log_debug(name(), "Enabling %s", (*it)->id()); - msg = new SwitchInterface::EnableSwitchMessage(); - } else { -// logger->log_debug(name(), "Disabling %s", (*it)->id()); - msg = new SwitchInterface::DisableSwitchMessage(); - } - (*it)->msgq_enqueue(msg); + msg_all_interfaces(switch_if_->is_enabled()); + } +} + +void +TabletopSwitchThread::msg_all_interfaces(const bool new_state) +{ + for (list<SwitchInterface *>::iterator it = tabletop_switch_ifs_.begin(); it != tabletop_switch_ifs_.end(); it++) { + Message *msg; + if (new_state) { + msg = new SwitchInterface::EnableSwitchMessage(); + } else { + msg = new SwitchInterface::DisableSwitchMessage(); } + (*it)->msgq_enqueue(msg); } } diff --git a/src/plugins/perception/tabletop-switch/tabletop_switch_thread.h b/src/plugins/perception/tabletop-switch/tabletop_switch_thread.h index 1f45f29..4b9d2bf 100644 --- a/src/plugins/perception/tabletop-switch/tabletop_switch_thread.h +++ b/src/plugins/perception/tabletop-switch/tabletop_switch_thread.h @@ -27,6 +27,7 @@ #include <aspect/blackboard.h> #include <aspect/blocked_timing.h> #include <aspect/logging.h> +#include <aspect/configurable.h> #include <interfaces/SwitchInterface.h> #include <list> @@ -40,17 +41,25 @@ class TabletopSwitchThread public fawkes::ClockAspect, public fawkes::BlackBoardAspect, public fawkes::LoggingAspect, + public fawkes::ConfigurableAspect, public fawkes::BlockedTimingAspect { public: TabletopSwitchThread(); virtual void init(); + virtual void once(); virtual void loop(); virtual void finalize(); + + private: + void msg_all_interfaces(const bool new_state); + private: fawkes::SwitchInterface *switch_if_; std::list<fawkes::SwitchInterface *> tabletop_switch_ifs_; + + bool cfg_initial_state_; }; #endif - *commit* fec1addfb17b3643a6ea33a5d80f7b586675c1f9 - - - - - - - - - - Author: Till Hofmann <hofm...@kbsg.rwth-aachen.de> Date: Mon Aug 11 15:47:20 2014 +0200 Subject: perception: always set visibility to false if plugin is disabled .../object-detection/object_detection_thread.cpp | 3 +++ .../object-fitting/object_fitting_thread.cpp | 3 +++ .../object-tracking/object_tracking_thread.cpp | 4 ++++ .../tabletop_detection_thread.cpp | 1 + 4 files changed, 11 insertions(+), 0 deletions(-) _Diff for modified files_: diff --git a/src/plugins/perception/object-detection/object_detection_thread.cpp b/src/plugins/perception/object-detection/object_detection_thread.cpp index 9a40dc2..fecb9cd 100644 --- a/src/plugins/perception/object-detection/object_detection_thread.cpp +++ b/src/plugins/perception/object-detection/object_detection_thread.cpp @@ -220,6 +220,9 @@ ObjectDetectionThread::loop() } else if (SwitchInterface::DisableSwitchMessage *msg = switch_if_->msgq_first_safe(msg)) { + for (PosIfsVector::iterator it = pos_ifs_.begin(); it != pos_ifs_.end(); it++) { + set_position(*it, false); + } switch_if_->set_enabled(false); switch_if_->write(); } diff --git a/src/plugins/perception/object-fitting/object_fitting_thread.cpp b/src/plugins/perception/object-fitting/object_fitting_thread.cpp index 527a294..fb6609b 100644 --- a/src/plugins/perception/object-fitting/object_fitting_thread.cpp +++ b/src/plugins/perception/object-fitting/object_fitting_thread.cpp @@ -206,6 +206,9 @@ ObjectFittingThread::loop() } else if (SwitchInterface::DisableSwitchMessage *msg = switch_if_->msgq_first_safe(msg)) { + for (vector<Position3DInterface *>::iterator it = pos_ifs_.begin(); it != pos_ifs_.end(); it++) { + set_position(*it, false); + } switch_if_->set_enabled(false); switch_if_->write(); } diff --git a/src/plugins/perception/object-tracking/object_tracking_thread.cpp b/src/plugins/perception/object-tracking/object_tracking_thread.cpp index e3ed90b..28cc9f2 100644 --- a/src/plugins/perception/object-tracking/object_tracking_thread.cpp +++ b/src/plugins/perception/object-tracking/object_tracking_thread.cpp @@ -149,6 +149,10 @@ ObjectTrackingThread::loop() } else if (SwitchInterface::DisableSwitchMessage *msg = switch_if_->msgq_first_safe(msg)) { + for (vector<Position3DInterface *>::iterator it = pos_ifs_out_.begin(); + it != pos_ifs_out_.end(); it++) { + set_position(*it, false); + } switch_if_->set_enabled(false); switch_if_->write(); } diff --git a/src/plugins/perception/tabletop-detection/tabletop_detection_thread.cpp b/src/plugins/perception/tabletop-detection/tabletop_detection_thread.cpp index 89e5b23..eb7c6ab 100644 --- a/src/plugins/perception/tabletop-detection/tabletop_detection_thread.cpp +++ b/src/plugins/perception/tabletop-detection/tabletop_detection_thread.cpp @@ -250,6 +250,7 @@ TabletopDetectionThread::loop() } else if (SwitchInterface::DisableSwitchMessage *msg = switch_if_->msgq_first_safe(msg)) { + set_position(table_pos_if_, false); switch_if_->set_enabled(false); switch_if_->write(); } -- Fawkes Robotics Framework http://www.fawkesrobotics.org _______________________________________________ fawkes-commits mailing list fawkes-commits@lists.kbsg.rwth-aachen.de https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits