how to use tf listener
Hello everyone. I didn't understand very well how to use tf,although I've read all the tutorials. I try to explain briefly: I use stage to simulate a robot that find some objects with a laser.Then I use a function findCoords to find the coords in the map of the objects found by the robot.Now i want to transform the point give by this function with tf,so what I made is to declare the listener as global variable,then do all the stuff and then in findCoords I do `listener.transformPoint("blabla",point,pointNew) then I compile and it gives no error but when i run it gives this error:
[FATAL] [1335431661.314896028]: You must call ros::init() before creating the first NodeHandle
[FATAL] [1335431661.314990035]: BREAKPOINT HIT
file = /tmp/buildd/ros-electric-ros-comm-1.6.6/debian/ros-electric-ros-comm/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/src/libros/node_handle.cpp
line=151
how can I solve this?
thanks markymark for answering,however i have called ros::init in the main..the structure is like this:tf::TransformListener listener as global variable,the function for coords is called from lasercallback and main
People need a lot more detail to help debug this. Can you demonstrate the problem in a small program?
I'm only guessing here - but is sounds like a scoping issue - but as joq says...code please.