ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
it didn't fit in comment space,so i'm writing here.. I try to give an example,what I'm doing is:
#include <ros/ros.h>
#include <tf/tf.h>
#include <tf/transform_listener.h>
"others include..."
tf::TransformListener listener; //as global variable
ros::Publisher pubLaser;
"others global variables..."
void findCoords(const sensor_msgs::LaserScanPtr dataFromLaser){
//in this function I have to transform,so i do the stuff and then..
listener.transformPoint("base_link",point,newPoint);
//where point,newPoint are StampedPoint
}
void laserCallback(const sensor_msgs::LaserScan::ConstPtr& fromLaser){
//do stuff...
findCoords(data);
}
int main(int argc,char** argv){
ros::init(argc,argv,"name");
ros::NodeHandle nh;
ros::Subscriber laser=nh.subscribe("base_scan",10,laserCallback);
pubLaser=nh.advertise<sensor_msgs::LaserScan>("from_Laser",100);
ros::spin();
return 0;
}
If i run it without the part of tf it works,but i didn't figure out how to make it run with tf,it gives me the error i said in the first post.