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/joint-pantilt has been updated
        to  134bf491ff6d5aaf912c0350a3f49f1a47d1a1e4 (commit)
      from  5a024dbeb523c6ae2cb2dcbce041060dd5818ae3 (commit)

http://git.fawkesrobotics.org/fawkes.git/thofmann/joint-pantilt

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 134bf491ff6d5aaf912c0350a3f49f1a47d1a1e4
Author:     Till Hofmann <hofm...@kbsg.rwth-aachen.de>
AuthorDate: Fri Sep 27 16:32:57 2013 +0200
Commit:     Till Hofmann <hofm...@kbsg.rwth-aachen.de>
CommitDate: Fri Sep 27 16:32:57 2013 +0200

    pantilt: only publish transforms if config value is set to true

http://git.fawkesrobotics.org/fawkes.git/commit/134bf49
http://trac.fawkesrobotics.org/changeset/134bf49

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


- *Summary* -----------------------------------------------------------
 cfg/conf.d/pantilt.yaml                     |    2 +
 src/plugins/pantilt/robotis/rx28_thread.cpp |   73 +++++++++++++++------------
 src/plugins/pantilt/robotis/rx28_thread.h   |    2 +
 3 files changed, 44 insertions(+), 33 deletions(-)


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

- *commit* 134bf491ff6d5aaf912c0350a3f49f1a47d1a1e4 - - - - - - - - - -
Author:  Till Hofmann <hofm...@kbsg.rwth-aachen.de>
Date:    Fri Sep 27 16:32:57 2013 +0200
Subject: pantilt: only publish transforms if config value is set to true

 cfg/conf.d/pantilt.yaml                     |    2 +
 src/plugins/pantilt/robotis/rx28_thread.cpp |   73 +++++++++++++++------------
 src/plugins/pantilt/robotis/rx28_thread.h   |    2 +
 3 files changed, 44 insertions(+), 33 deletions(-)

_Diff for modified files_:
diff --git a/cfg/conf.d/pantilt.yaml b/cfg/conf.d/pantilt.yaml
index 9ed27e0..eaa7240 100644
--- a/cfg/conf.d/pantilt.yaml
+++ b/cfg/conf.d/pantilt.yaml
@@ -79,6 +79,8 @@ doc-url: !url 
http://trac.fawkesrobotics.org/wiki/Plugins/pantilt
     tilt_trans_y: 0.0
     # TILT servo base to joint translation Z; m
     tilt_trans_z: 0.039
+    # whether transforms should be published
+    publish_transforms: true
 
   # Type of PTU; one of RX28, EviD100P and DirectedPerceptionASCII
   EviD100P:
diff --git a/src/plugins/pantilt/robotis/rx28_thread.cpp 
b/src/plugins/pantilt/robotis/rx28_thread.cpp
index cd45a7c..325b66f 100644
--- a/src/plugins/pantilt/robotis/rx28_thread.cpp
+++ b/src/plugins/pantilt/robotis/rx28_thread.cpp
@@ -99,34 +99,39 @@ PanTiltRX28Thread::init()
   __cfg_tilt_margin      = config->get_float((__ptu_cfg_prefix + 
"tilt_margin").c_str());
   __cfg_pan_start        = config->get_float((__ptu_cfg_prefix + 
"pan_start").c_str());
   __cfg_tilt_start       = config->get_float((__ptu_cfg_prefix + 
"tilt_start").c_str());
-
 #ifdef HAVE_TF
-  float pan_trans_x  =
-    config->get_float((__ptu_cfg_prefix + "pan_trans_x").c_str());
-  float pan_trans_y  =
-    config->get_float((__ptu_cfg_prefix + "pan_trans_y").c_str());
-  float pan_trans_z  =
-    config->get_float((__ptu_cfg_prefix + "pan_trans_z").c_str());
-  float tilt_trans_x =
-    config->get_float((__ptu_cfg_prefix + "tilt_trans_x").c_str());
-  float tilt_trans_y =
-    config->get_float((__ptu_cfg_prefix + "tilt_trans_y").c_str());
-  float tilt_trans_z =
-    config->get_float((__ptu_cfg_prefix + "tilt_trans_z").c_str());
+  __cfg_publish_transforms=config->get_bool((__ptu_cfg_prefix + 
"publish_transforms").c_str());
+#endif
 
-  
-  std::string frame_id_prefix = std::string("/") + __ptu_name;
-  try {
-    frame_id_prefix =
-      config->get_string((__ptu_cfg_prefix + "frame_id_prefix").c_str());
-  } catch (Exception &e) {} // ignore, use default
+#ifdef HAVE_TF
+  if (__cfg_publish_transforms) {
+    float pan_trans_x  =
+        config->get_float((__ptu_cfg_prefix + "pan_trans_x").c_str());
+    float pan_trans_y  =
+        config->get_float((__ptu_cfg_prefix + "pan_trans_y").c_str());
+    float pan_trans_z  =
+        config->get_float((__ptu_cfg_prefix + "pan_trans_z").c_str());
+    float tilt_trans_x =
+        config->get_float((__ptu_cfg_prefix + "tilt_trans_x").c_str());
+    float tilt_trans_y =
+        config->get_float((__ptu_cfg_prefix + "tilt_trans_y").c_str());
+    float tilt_trans_z =
+        config->get_float((__ptu_cfg_prefix + "tilt_trans_z").c_str());
+
+
+    std::string frame_id_prefix = std::string("/") + __ptu_name;
+    try {
+      frame_id_prefix =
+          config->get_string((__ptu_cfg_prefix + "frame_id_prefix").c_str());
+    } catch (Exception &e) {} // ignore, use default
 
-  __cfg_base_frame = frame_id_prefix + "/base";
-  __cfg_pan_link   = frame_id_prefix + "/pan";
-  __cfg_tilt_link  = frame_id_prefix + "/tilt";
+    __cfg_base_frame = frame_id_prefix + "/base";
+    __cfg_pan_link   = frame_id_prefix + "/pan";
+    __cfg_tilt_link  = frame_id_prefix + "/tilt";
 
-  __translation_pan.setValue(pan_trans_x, pan_trans_y, pan_trans_z);
-  __translation_tilt.setValue(tilt_trans_x, tilt_trans_y, tilt_trans_z);
+    __translation_pan.setValue(pan_trans_x, pan_trans_y, pan_trans_z);
+    __translation_tilt.setValue(tilt_trans_x, tilt_trans_y, tilt_trans_z);
+  }
 #endif
 
   bool pan_servo_found = false, tilt_servo_found = false;
@@ -300,14 +305,16 @@ PanTiltRX28Thread::update_sensor_values()
     __tiltjoint_if->write();
 
 #ifdef HAVE_TF
-    // Always publish updated transforms
-    tf::Quaternion pr;  pr.setEulerZYX(pan, 0, 0);
-    tf::Transform ptr(pr, __translation_pan);
-    tf_publisher->send_transform(ptr, time, __cfg_base_frame, __cfg_pan_link);
-
-    tf::Quaternion tr; tr.setEulerZYX(0, tilt, 0);
-    tf::Transform ttr(tr, __translation_tilt);
-    tf_publisher->send_transform(ttr, time, __cfg_pan_link, __cfg_tilt_link);
+    if (__cfg_publish_transforms) {
+      // Always publish updated transforms
+      tf::Quaternion pr;  pr.setEulerZYX(pan, 0, 0);
+      tf::Transform ptr(pr, __translation_pan);
+      tf_publisher->send_transform(ptr, time, __cfg_base_frame, 
__cfg_pan_link);
+
+      tf::Quaternion tr; tr.setEulerZYX(0, tilt, 0);
+      tf::Transform ttr(tr, __translation_tilt);
+      tf_publisher->send_transform(ttr, time, __cfg_pan_link, __cfg_tilt_link);
+    }
 #endif
   }
 }
diff --git a/src/plugins/pantilt/robotis/rx28_thread.h 
b/src/plugins/pantilt/robotis/rx28_thread.h
index 62b3d9e..44ed770 100644
--- a/src/plugins/pantilt/robotis/rx28_thread.h
+++ b/src/plugins/pantilt/robotis/rx28_thread.h
@@ -112,6 +112,8 @@ class PanTiltRX28Thread
 
   fawkes::tf::Vector3  __translation_pan;
   fawkes::tf::Vector3  __translation_tilt;
+
+  bool         __cfg_publish_transforms;
 #endif
 
   float         __last_pan;




-- 
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

Reply via email to