Advertisement
shankerkeshavdas

ROS-Answers/Navigation/LaserTF

Feb 1st, 2012
217
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // AUTHOR : SHANKER KESHAVDAS , DFKI SAARBRUECKEN
  2.  
  3. #ifndef TAROT_RobotControl_TFLaserPublisher_CPP_
  4. #define TAROT_RobotControl_TFLaserPublisher_CPP_
  5.  
  6. #include <ros/ros.h>
  7. #include <tf/transform_broadcaster.h>
  8.  
  9. #define LASERPOSITION_X 0.17
  10. #define LASERPOSITION_Y 0.0
  11. #define LASERPOSITION_Z 0.298
  12.  
  13. // Publishes a static transform from frame /base_link to /laser. This denotes the position of the laser with respect to the center of the robot on the 2D map.
  14.  
  15. int main(int argc, char **argv)
  16. {
  17. ros::init(argc, argv, "Tarot_TFLaserPublisher");
  18. static tf::TransformBroadcaster br;
  19. tf::Transform transform;
  20. transform.setOrigin( tf::Vector3(LASERPOSITION_X,LASERPOSITION_Y,LASERPOSITION_Z) );
  21. transform.setRotation( tf::Quaternion(0, 0, 0, 1) );
  22. ros::Rate r(10);
  23. while(ros::ok())
  24. {
  25. br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "base_link", "laser"));
  26. r.sleep();
  27. }
  28. }
  29.  
  30. #endif
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement