{{{#!wiki tip
Using ROS 2? Check out the [[https://docs.ros.org/en/rolling/Tutorials/Intermediate/Tf2/Tf2-Main.html|ROS 2 tf2 tutorials]].
}}}

## For instruction on writing tutorials
## http://www.ros.org/wiki/WritingTutorials
####################################
##FILL ME IN
####################################
## for a custom note with links:
## note =
## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links
## note.0=
## descriptive title for the tutorial
## title = Migrating a TransformBroadcaster from tf to tf2
## multi-line description to be displayed in search
## description = This is a guide for converting a tf !TransformBroadcaster class to a tf2 Broadcaster class
## the next tutorial description (optional)
## next =
## links to next tutorial (optional)
## next.0.link=
## next.1.link=
## what level user is this tutorial for
## level= IntermediateCategory
## keywords =
####################################
<<IncludeCSTemplate(TutorialCSHeaderTemplate)>>

<<TableOfContents(4)>>

== Primary difference ==
The TransformBroadcaster uses the public API only and populates an independently allocated tf2 Buffer.

== C++ ==
=== Old Style ===
Depend on tf package.

{{{#!cplusplus
#include "tf/transform_broadcaster.h"
#include "tf/transform_datatypes.h"
#include "geometry_msgs/TransformStamped.h"

tf::TransformBroadcaster tfb;

geometry_msgs::TransformStamped transformGeom = ...;
tfb.sendTransform(transformGeom);

tf::StampedTransform transformTf = ...;
tfb.sendTransform(transformTf);
}}}
=== Equivalent tf2 Replacement ===
Depend on tf2_ros package and possibly also tf2_geometry_msgs.

{{{#!cplusplus
#include "tf2_ros/transform_broadcaster.h"
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
#include "geometry_msgs/TransformStamped.h"

tf2_ros::TransformBroadcaster tfb;

geometry_msgs::TransformStamped transformGeom = ...;
tfb.sendTransform(transformGeom);  # this stays the same

# there is no tf2::StampedTransform... 
# only tf2::Stamped<Transform> which misses child_frame_id
tf2::Stamped<Transform> transformTf = ...;
geometry_msgs::TransformStamped transformTfGeom = tf2::toMsg(transformTf);
transformTfGeom.child_frame_id = ...;
tfb.sendTransform(transformTfGeom);
}}}
== Python ==
=== Old Style ===
Depend on tf package.

{{{#!python
import tf
tfb = tf.TransformBroadcaster()
}}}
=== Equivalent tf2 Replacement ===
Depend on tf2_ros pacakage.

{{{#!python
import tf2_ros
tfb = tf2_ros.TransformBroadcaster()
}}}
## AUTOGENERATED DO NOT DELETE
## TutorialCategory MigrationCategory
## FILL IN THE STACK TUTORIAL CATEGORY HERE