[ros-users] Navigaation/tutorials/TF - error in Broadcasting.cpp

shashank sharma sonicboomshanky at gmail.com
Thu Mar 18 15:51:40 UTC 2010


http://www.ros.org/wiki/navigation/Tutorials/RobotSetup/TF

In the above page the "tf_braodcaster.cpp" file has an error as the
sendTransform() function has unmatched arguments.

here is the corrected code:

#include <ros/ros.h>
#include <tf/transform_broadcaster.h>

int main(int argc, char** argv){
  ros::init(argc, argv, "robot_tf_publisher");
  ros::NodeHandle n;

  ros::Rate r(100);

  //corrected code
  tf::Transform transform;
  transform.setOrigin(tf::Vector3(0.1, 0.0, 0.2));
  transform.setRotation(tf::Quaternion(0, 0, 0));



  tf::TransformBroadcaster broadcaster;

  while(n.ok()){
    /*broadcaster.sendTransform(
        btTransform(btQuaternion(0, 0, 0), btVector3(0.1, 0.0, 0.2)),
        ros::Time::now(),
        "base_laser", "base_link");
    */
broadcaster.sendTransform(tf::StampedTransform(transform, ros::Time::now(),
"base_laser", "base_link"));
 r.sleep();
  }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100318/cbdaa44b/attachment-0002.html>


More information about the ros-users mailing list