tf problems; error: tf/transform_listener.h: No such file or directory
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
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;
};
Asked by Astronaut on 2012-08-21 17:21:17 UTC
Comments
Something about your code has been badly mis-formatted; can you correct that, so we can see what's going on?
Asked by Mac on 2012-08-21 17:51:25 UTC
ok done it
Asked by Astronaut on 2012-08-21 18:11:04 UTC
Do you have the geometry stack installed on your development system? Does
roscd tf
work?Asked by joq on 2012-08-22 04:58:14 UTC
+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
Asked by piyushk on 2012-08-22 09:39:16 UTC
Yes . roscd works. I have everything
Asked by Astronaut on 2012-08-22 14:18:31 UTC
@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.
Asked by piyushk on 2012-08-23 06:07:54 UTC