diff --git a/tf/include/tf/tf.h b/tf/include/tf/tf.h index 92fa031d..39cadd1b 100644 --- a/tf/include/tf/tf.h +++ b/tf/include/tf/tf.h @@ -294,7 +294,7 @@ class Transformer /** \brief A way to see what frames have been cached * Useful for debugging */ - std::string allFramesAsDot() const; + std::string allFramesAsDot(double current_time = 0) const; /** \brief A way to get a std::vector of available frame ids */ void getFrameStrings(std::vector& ids) const; diff --git a/tf/scripts/view_frames b/tf/scripts/view_frames index 6683ecd0..8e765efb 100755 --- a/tf/scripts/view_frames +++ b/tf/scripts/view_frames @@ -61,7 +61,7 @@ def listen(duration): print "Listening to /tf for %f seconds"%duration time.sleep(duration) print "Done Listening" - return tf_listener.allFramesAsDot() + return tf_listener.allFramesAsDot(rospy.Time.now()) def poll(node_name): diff --git a/tf/src/pytf.cpp b/tf/src/pytf.cpp index e0885db9..077fd38a 100644 --- a/tf/src/pytf.cpp +++ b/tf/src/pytf.cpp @@ -139,10 +139,14 @@ static PyObject *getTFPrefix(PyObject *self, PyObject *args) return PyString_FromString(t->getTFPrefix().c_str()); } -static PyObject *allFramesAsDot(PyObject *self, PyObject *args) +static PyObject *allFramesAsDot(PyObject *self, PyObject *args, PyObject *kw) { tf::Transformer *t = ((transformer_t*)self)->t; - return PyString_FromString(t->allFramesAsDot().c_str()); + static const char *keywords[] = { "time", NULL }; + ros::Time time; + if (!PyArg_ParseTupleAndKeywords(args, kw, "|O&", (char**)keywords, rostime_converter, &time)) + return NULL; + return PyString_FromString(t->allFramesAsDot(time.toSec()).c_str()); } static PyObject *allFramesAsString(PyObject *self, PyObject *args) @@ -445,7 +449,7 @@ static PyObject *getFrameStrings(PyObject *self, PyObject *args) static struct PyMethodDef transformer_methods[] = { - {"allFramesAsDot", allFramesAsDot, METH_VARARGS}, + {"allFramesAsDot", (PyCFunction)allFramesAsDot, METH_KEYWORDS}, {"allFramesAsString", allFramesAsString, METH_VARARGS}, {"setTransform", setTransform, METH_VARARGS}, {"canTransform", (PyCFunction)canTransform, METH_KEYWORDS}, diff --git a/tf/src/tf.cpp b/tf/src/tf.cpp index 2a6b0a3a..a4f94953 100644 --- a/tf/src/tf.cpp +++ b/tf/src/tf.cpp @@ -436,9 +436,9 @@ std::string Transformer::allFramesAsString() const return tf2_buffer_.allFramesAsString(); } -std::string Transformer::allFramesAsDot() const +std::string Transformer::allFramesAsDot(double current_time) const { - return tf2_buffer_._allFramesAsDot(); + return tf2_buffer_._allFramesAsDot(current_time); }