ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

tf broadcasting rate

asked 2017-07-02 11:03:51 -0600

alonsheader gravatar image

updated 2017-07-02 12:11:21 -0600

gvdhoorn gravatar image

hello

im trying to increase the rate of which tf transform is being published it seems that no matter what i do the rate stays 1 hz even if cout prints at 10 hz, when i tf_echo the transform it still appears to be published at 1 hz i didnt find in ROS ANSWER any documentation about that

thanks!

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

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

  ros::Rate r(10.0);

  tf::TransformBroadcaster broadcaster;

  while(n.ok()){
    broadcaster.sendTransform(
      tf::StampedTransform(
        tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.1, 0.0, 0.2)),
        ros::Time::now(),"map", "odom"));
    std::cout<< ros::Time::now() <<std::endl;
    r.sleep();
    ros::spinOnce();

  }
}
edit retag flag offensive close merge delete

Comments

This probably won't fix the issue, but put the ros::spinOnce(); call before the r.sleep(); call. You should never have anything after a Rate.sleep() call as this messes with loop timing.

ufr3c_tjc gravatar image ufr3c_tjc  ( 2017-07-02 18:11:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-07-02 18:33:04 -0600

tfoote gravatar image

The rate at which tf_echo prints to the screen is a command line argument and does not reflect the underlying message rates.

If you want to determine the rate of publishing you should use tf_monitor. There's a tutorial on debugging.

edit flag offensive delete link more

Comments

Totally agree. The correct way to view the rate is actually using view_frames tool

DavidN gravatar image DavidN  ( 2017-07-02 20:59:54 -0600 )edit

thank you!

alonsheader gravatar image alonsheader  ( 2017-07-03 02:44:42 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-07-02 11:03:51 -0600

Seen: 2,482 times

Last updated: Jul 02 '17