[Fawkes Git] branch/timn/robotino-direct: 2 revs updated. (0.5.0-3102-g0e758a7)

Tim Niemueller niemueller at kbsg.rwth-aachen.de
Wed Apr 13 13:10:36 CEST 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/robotino-direct has been updated
        to  0e758a742bf54eb4e85479bb5282c30229c9efd1 (commit)
       via  30810b68a4aca5d0f31f6c3e3ed5ba73614bcb6a (commit)
      from  aa26d1ea265fb1fea6f2c722289c59a21ce5506d (commit)

http://git.fawkesrobotics.org/fawkes.git/timn/robotino-direct

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 30810b68a4aca5d0f31f6c3e3ed5ba73614bcb6a
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Wed Apr 13 12:52:36 2016 +0200
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Wed Apr 13 12:52:36 2016 +0200

    tf: better timestamp formatting in exceptions

http://git.fawkesrobotics.org/fawkes.git/commit/30810b6
http://trac.fawkesrobotics.org/changeset/30810b6

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 0e758a742bf54eb4e85479bb5282c30229c9efd1
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Wed Apr 13 13:10:19 2016 +0200
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Wed Apr 13 13:10:19 2016 +0200

    robotino: configurable timeouts and intervals

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

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


- *Summary* -----------------------------------------------------------
 cfg/conf.d/robotino.yaml                   |   11 +++++++++++
 src/libs/tf/time_cache.cpp                 |   10 +++++-----
 src/plugins/robotino/direct_com_thread.cpp |   13 ++++++++-----
 src/plugins/robotino/direct_com_thread.h   |    5 ++++-
 4 files changed, 28 insertions(+), 11 deletions(-)


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

- *commit* 30810b68a4aca5d0f31f6c3e3ed5ba73614bcb6a - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Wed Apr 13 12:52:36 2016 +0200
Subject: tf: better timestamp formatting in exceptions

 src/libs/tf/time_cache.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/tf/time_cache.cpp b/src/libs/tf/time_cache.cpp
index ac09145..8516171 100644
--- a/src/libs/tf/time_cache.cpp
+++ b/src/libs/tf/time_cache.cpp
@@ -175,7 +175,7 @@ create_extrapolation_exception1(fawkes::Time t0, fawkes::Time t1, std::string* e
     char *tmp;
     if (asprintf(&tmp, "Lookup would require extrapolation at time %li.%li, "
                  "but only time %li.%li is in the buffer", t0.get_sec(), t0.get_nsec(),
-                 t1.get_sec(), t1.get_nsec()) != -1)
+                 t1.get_sec(), t1.get_usec()) != -1)
     {
       *error_str = tmp;
       free(tmp);
@@ -195,8 +195,8 @@ create_extrapolation_exception2(fawkes::Time t0, fawkes::Time t1, std::string* e
   {
     char *tmp;
     if (asprintf(&tmp,"Lookup would require extrapolation into the future. "
-                 "Requested time %s, but the latest data is at time %s",
-                 t0.str(), t1.str()) != -1)
+                 "Requested time %li.%li, but the latest data is at time %li.%li",
+                 t0.get_sec(), t0.get_usec(), t1.get_sec(), t1.get_usec()) != -1)
     {
       *error_str = tmp;
       free(tmp);
@@ -216,8 +216,8 @@ create_extrapolation_exception3(fawkes::Time t0, fawkes::Time t1, std::string* e
   {
     char *tmp;
     if (asprintf(&tmp,"Lookup would require extrapolation into the past. "
-                 "Requested time %s, but the latest data is at time %s",
-                 t0.str(), t1.str()) != -1)
+                 "Requested time %li.%li, but the latest data is at time %li.%li",
+                 t0.get_sec(), t0.get_usec(), t1.get_sec(), t1.get_usec()) != -1)
     {
       *error_str = tmp;
       free(tmp);

- *commit* 0e758a742bf54eb4e85479bb5282c30229c9efd1 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Wed Apr 13 13:10:19 2016 +0200
Subject: robotino: configurable timeouts and intervals

 cfg/conf.d/robotino.yaml                   |   11 +++++++++++
 src/plugins/robotino/direct_com_thread.cpp |   13 ++++++++-----
 src/plugins/robotino/direct_com_thread.h   |    5 ++++-
 3 files changed, 23 insertions(+), 6 deletions(-)

_Diff for modified files_:
diff --git a/cfg/conf.d/robotino.yaml b/cfg/conf.d/robotino.yaml
index 7eb041e..44aa840 100644
--- a/cfg/conf.d/robotino.yaml
+++ b/cfg/conf.d/robotino.yaml
@@ -47,6 +47,17 @@ hardware/robotino:
     # the group dialout: usermod -a -G dialout robotino (and reboot)
     # device: /dev/ttyACM1
 
+    # Timeout in milliseconds after which the connection is considered
+    # to be dead and re-established by closing and re-opening the device
+    no-data-timeout: 2000
+
+    # Interval in milliseconds in which to send wheel velocity updates
+    # while driving
+    drive-update-interval: 20
+
+    # Timeout in milliseconds for a single read operation
+    read-timeout: 200
+
 
   # The motor and drive settings and limits are enforced for direct
   # communication, for the openrobotino driver, these values are
diff --git a/src/plugins/robotino/direct_com_thread.cpp b/src/plugins/robotino/direct_com_thread.cpp
index cc83823..ebd6b8b 100644
--- a/src/plugins/robotino/direct_com_thread.cpp
+++ b/src/plugins/robotino/direct_com_thread.cpp
@@ -71,7 +71,10 @@ DirectRobotinoComThread::init()
 		config->get_uint("/hardware/robotino/cycle-time");
 	cfg_gripper_enabled_ = config->get_bool("/hardware/robotino/gripper/enable_gripper");
 	cfg_rpm_max_ = config->get_float("/hardware/robotino/motor/rpm-max");
-
+	cfg_nodata_timeout_ = config->get_uint("/hardware/robotino/direct/no-data-timeout");
+	cfg_drive_update_interval_ = config->get_uint("/hardware/robotino/direct/drive-update-interval");
+	cfg_read_timeout_ = config->get_uint("/hardware/robotino/direct/read-timeout");
+	
 	// -------------------------------------------------------------------------- //
 
 	if (find_controld3()) {
@@ -589,7 +592,7 @@ DirectRobotinoComThread::flush_device()
 				ec = boost::asio::error::would_block;
 				bytes_read = 0;
 
-				deadline_.expires_from_now(boost::posix_time::milliseconds(200));
+				deadline_.expires_from_now(boost::posix_time::milliseconds(cfg_read_timeout_));
 				boost::asio::async_read(serial_, input_buffer_,
 				                        boost::asio::transfer_at_least(1),
 				                        (boost::lambda::var(ec) = boost::lambda::_1,
@@ -708,7 +711,7 @@ DirectRobotinoComThread::read_packet()
 	input_buffer_.consume(bytes_read - 1);
 	
 	// start timeout for remaining packet
-	deadline_.expires_from_now(boost::posix_time::milliseconds(200));
+	deadline_.expires_from_now(boost::posix_time::milliseconds(cfg_read_timeout_));
 
 	// read packet length
 	ec = boost::asio::error::would_block;
@@ -848,7 +851,7 @@ DirectRobotinoComThread::drive()
 {
 	if (finalize_prepared)  return;
 
-	drive_timer_.expires_from_now(boost::posix_time::milliseconds(10));
+	drive_timer_.expires_from_now(boost::posix_time::milliseconds(cfg_drive_update_interval_));
 	drive_timer_.async_wait(boost::bind(&DirectRobotinoComThread::handle_drive, this,
 	                                    boost::asio::placeholders::error));	
 }
@@ -867,7 +870,7 @@ void
 DirectRobotinoComThread::update_nodata_timer()
 {
 	nodata_timer_.cancel();
-	nodata_timer_.expires_from_now(boost::posix_time::milliseconds(2000));
+	nodata_timer_.expires_from_now(boost::posix_time::milliseconds(cfg_nodata_timeout_));
 	nodata_timer_.async_wait(boost::bind(&DirectRobotinoComThread::handle_nodata, this,
 	                                     boost::asio::placeholders::error));
 }
diff --git a/src/plugins/robotino/direct_com_thread.h b/src/plugins/robotino/direct_com_thread.h
index 1a53532..d58d1d0 100644
--- a/src/plugins/robotino/direct_com_thread.h
+++ b/src/plugins/robotino/direct_com_thread.h
@@ -103,7 +103,10 @@ class DirectRobotinoComThread
 	unsigned int    cfg_sensor_update_cycle_time_;
 	bool            cfg_gripper_enabled_;
 	float           cfg_rpm_max_;
-
+	unsigned int    cfg_nodata_timeout_;
+	unsigned int    cfg_drive_update_interval_;
+	unsigned int    cfg_read_timeout_;
+	
 	bool opened_;
 	unsigned int open_tries_;
 




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


More information about the fawkes-commits mailing list