Migrating a TransformListener from tf to tf2

Description: This is a guide for converting a tf TransformListener class to a tf2 Listener class

Tutorial Level: INTERMEDIATE

Primary difference

The TransformListener uses the public API only and populates an independently allocated tf2::Buffer.

C++

Old Style

Depend on tf package.

   1 #include "tf/transform_listener.h"
   2 tf::TransformListener tfl;

Equivilant Replacement

Depend on tf_ros package.

   1 #include "tf2_cpp/transform_listener.h"
   2 tf2::Buffer buffer;
   3 tf2::TransformListener tfl(buffer);

Python

Old Style

Depend on tf package.

   1 import tf
   2 tfl = tf.TransformListener()

Equivilant Replacement

Depend on tf_ros package.

   1 import tf2_ros
   2 buffer = tf2.Buffer()
   3 tfl = tf2_ros.TransformListener(buffer)

Wiki: tf2/Tutorials/Migration/TransformListener (last edited 2010-10-01 02:55:02 by TullyFoote)