turtle_tf_listener.cpp
#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <iostream>
using namespace std;
double x,y,z,ww,zz,hh,ii,Aww,Azz,Ahh,Aii;
int main(int argc, char** argv){
ros::init(argc, argv, "my_tf_listener");
ros::NodeHandle node;
tf::TransformListener listener;
ros::Rate rate(10.0);
while (node.ok()){
tf::StampedTransform transform;
try{
listener.waitForTransform("odom", "base_link", ros::Time(0), ros::Duration(1.0));
listener.lookupTransform("odom", "base_link",
ros::Time(0), transform);
}
catch (tf::TransformException &ex) {
ROS_ERROR("%s",ex.what());
ros::Duration(1.0).sleep();
}
x=transform.getOrigin().x();
y=transform.getOrigin().y();
z=transform.getOrigin().z();
cout<<"x: "<<x<<endl;
cout<<"y: &