Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 130

tf2 sendTransform() not actually sending anything

$
0
0
I'm trying to send a transformation from "world" to "base_link" based on coordinates I get from a different node. The node is actually running, and it is reaching the ROS_INFO() right before the `broadcaster.sendTransform(transformStamped);` (so the other node is working, and the tf2 broadcaster node gets the data and the callback is called repeatedly), but when I run `rosrun tf tf_monitor` to see what I get, it's empty: RESULTS: for all Frames Frames: All Broadcasters: I've been trying to find the mistake for 2 days now and I don't see what I'm doing wrong. Any advise? #include #include #include #include #include "geometry_msgs/PoseStamped.h" void posCallback(const geometry_msgs::PoseStamped& msg){ tf2_ros::TransformBroadcaster broadcaster; geometry_msgs::TransformStamped transformStamped; transformStamped.header.stamp = ros::Time::now(); transformStamped.header.frame_id = "world"; transformStamped.child_frame_id = "base_link"; transformStamped.transform.translation.x = msg.pose.position.x; transformStamped.transform.translation.y = msg.pose.position.y; transformStamped.transform.translation.z = msg.pose.position.z; transformStamped.transform.rotation.x = msg.pose.orientation.x; transformStamped.transform.rotation.y = msg.pose.orientation.y; transformStamped.transform.rotation.z = msg.pose.orientation.z; transformStamped.transform.rotation.w = msg.pose.orientation.w; ROS_INFO("broadcast"); broadcaster.sendTransform(transformStamped); } int main(int argc, char **argv) { ros::init(argc, argv, "base_link_broadcaster"); ros::NodeHandle node; ros::Subscriber sub = node.subscribe("positioning", 1000, posCallback); ros::spin(); return 0; }

Viewing all articles
Browse latest Browse all 130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>