tf problems; error: tf/transform_listener.h: No such file or directory [closed]
Hello
I made a node that use a TF but when tried to compiled I got the following error. error: tf/transform_listener.h: No such file or directory
I include the tf dependency in the manifest.xml file, i;e
<depend package="tf"/>
So I dont know what is the problem
Any help?
This is my node
#include <ros/ros.h>
#include <tf/transform_listener.h>
#include "std_msgs/String.h"
#include "sensor_msgs/LaserScan.h"
#include <vector>
#include <iostream>
#include <fstream>
#include <ros/package.h>
#include "geometry_msgs/PoseWithCovarianceStamped.h"
#include "geometry_msgs/Quaternion.h"
#include "/opt/ros/fuerte/stacks/bullet/include/LinearMath/btScalar.h"
#include "/opt/ros/fuerte/stacks/bullet/include/LinearMath/btQuaternion.h"
#include "/opt/ros/fuerte/stacks/bullet/include/LinearMath/btMatrix3x3.h"
#include "std_msgs/Float64.h"
std::ofstream myfile;
int main(int argc, char** argv){
ros::init(argc, argv, "my_tf_listener");
ros::NodeHandle node;
myfile.open ("/home/bojan/Desktop/PowRos/utils/pow_analyzer/src/distance.txt");
myfile << "distance in m" << " " "\n";
tf::TransformListener listener;
ros::Rate rate(10.0);
while (node.ok())
{
tf::StampedTransform transform;
try
{
listener.lookupTransform("/base_link", "/door1",
ros::Time(0), transform);
}
catch (tf::TransformException ex)
{
ROS_ERROR("%s",ex.what());
}
double x = transform.getOrigin().x();
double y = transform.getOrigin().y();
double dist = sqrt(x*x + y*y);
ROS_INFO("dist = %f" , dist);
myfile << dist << " " "\n";
rate.sleep();
}
return 0;
};
Something about your code has been badly mis-formatted; can you correct that, so we can see what's going on?
ok done it
Do you have the geometry stack installed on your development system? Does
roscd tf
work?+1 for suggestion made by @joq. I think I have also managed to produce this error in the past by accidentally calling add_executable instead of rosbuild_add_executable in my CMakeLists file
Yes . roscd works. I have everything
@Astronaut: Hmm, you might have to put a tar of the package somewhere, and link it in the question. Given that tf is installed, it's not quite possible to figure out what the error might be given the current information.