how to broadcast a tf frame? [closed]
Hello,
I have a tf frame named /base_link which is part of the turtlebot 2. I am trying to take the information that the /base_link frame contains such as its position(xyz) and its orientation(rpy) and broadcast this info to a new tf frame. The reason why I am doing this is because I could not tf_remap to work. So I am thinking that the next step is to create a broadcaster that sends out this info as a new name. I am highly confused of what info goes where. Below is the code that I have so far. I grabbed this info from the tf tutorials available on the wiki page.
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
void poseCallback( ){ //don't know what to pass through
static tf::TransformBroadcaster br;
tf::Transform transform;
transform.setOrigin( tf::Vector3(msg->x, msg->y, 0.0) );
transform.setRotation( tf::Quaternion(msg->theta, 0, 0) );
br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "base_footprint", "base_link")); //don't know what to pass through
}
int main(int argc, char** argv){
ros::init(argc, argv, "my_tf_broadcaster");
ros::NodeHandle node;
ros::Subscriber sub = node.subscribe("move_base/pose", 10, &poseCallback);
ros::spin();
return 0;
};
I'm not sure with what you mean with "pass through", but it seems that you are trying a hack to do something that should be solved properly.
what is
move_base/pose
data type. What exactly you are trying to do.What I am trying to do is really complicated it would take to long to explain. For simple purposes, I have a /tf frame that been received from another turtlebot through a foreign relay. Now I have a program that is going to compare information on both of the /tf topics. However, the /tf header id's
are not being resolved such as /tf and /leader/tf. In other words the node that I am having read this info is such as transform("base_link" , "leader/base_link", .......) I tried to remap the topic received by the foreign relay to be /leader/tf but that does not work
So Now I am trying to create a broadcaster that changes the name to "leader/base_link"
move_base/pose is simply the position of the turtlebot in reference to it's base_link
Hi, you have to check frameid in callback and broadcast transform with the frame names you want. but i guess pose is geometry_msgs::Pose type and it doesn't have header to check frameid. Still need info on your question.
I will update question in a few hours. I am working on something.