How to increase the rate of broadcasting
Hello,
I have written a base_link to map broadcaster and I am trying to increase the rate of broadcasting to 50 hz.
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <geometry_msgs/PoseStamped.h>
void poseCallback(const geometry_msgs::PoseStamped::ConstPtr& msg){
static tf::TransformBroadcaster broadcaster;
tf::Transform transform;
transform.setOrigin( tf::Vector3(-msg->pose.position.x, -msg->pose.position.y, -msg->pose.position.z));
transform.setRotation(tf::Quaternion(-msg->pose.orientation.x, -msg->pose.orientation.y, -msg->pose.orientation.z, msg->pose.orientation.w));
broadcaster.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "base_link", "map"));
ROS_INFO("Broadcasting between map and base_link successful !!!");
}
int main(int argc, char** argv){
ros::init(argc, argv, "tf_broadcaster_node");
ros::NodeHandle node;
ros::Subscriber sub = node.subscribe("/slam_out_pose", 7, &poseCallback);
ros::spin();
return 0;
};
How can I do that ?
I checked the tf::Transform::sendTransform member function but I didn't find an input for that.
I also wanted to ask if is there another way to broadcast the connection from base_link to map ?
Thanks for your answer in advance.