Unable to #include pcl files in header
Hi there,
I am trying to understand how to publish and subscribe to a PointCloud2 data from Kinect. Here is a sample program that publishes a PointCloud data.
#include <ros/ros.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;
int main(int argc, char** argv)
{
ros::init (argc, argv, "pub_pcl");
ros::NodeHandle nh;
ros::Publisher pub = nh.advertise<PointCloud> ("points2", 1);
PointCloud::Ptr msg (new PointCloud);
msg->header.frame_id = "some_tf_frame";
msg->height = msg->width = 1;
msg->points.push_back (pcl::PointXYZ(1.0, 2.0, 3.0));
ros::Rate loop_rate(4);
while (nh.ok())
{
msg->header.stamp = ros::Time::now ();
pub.publish (msg);
ros::spinOnce ();
loop_rate.sleep ();
}
}
However, there are errors. My system cannot find files #include <pcl_ros/point_cloud.h>
and #include <pcl/point_types.h>
. I tried to search for the files, and got them under /pcl-1.5/pcl/point_types.h
.
I tried to #include the above path. Now the error changed to fatal error: Eigen/StdVector: No such file or directory, compilation terminated.
Here are my Questions:
Why I have files under
/pcl-1.5/pcl/point_types.h
rather than generalpcl/point_types.h
? Does it make a difference. Same question forpcl_ros/point_cloud.h
What am I doing wrong? why an already given code is not running properly?
I have no folder called pcl_ros. Why?
Any answer will be appreciated.
I think you will get errors trying to compile this file. But let's try to solve your first problem. When you look for roscd pcl_ros you find nothing, right? And what is your ROS distribution and Ubuntu Release?
Interestingly roscd pcl_ros gives the following path. /opt/ros/fuerte/stacks/perception_pcl/pcl_ros I have ros-fuerte and ubuntu 12.04. Am I using two copies of pcl? one under /pcl-1.5/pcl and another under /stacks/perception_pcl?
Try to add manually the source: source /opt/ros/fuerte/setup.bash , or something like that and run again. Let me know if the same error occur.
sorry for my dumbness but I didnt get it. Where should I add source /opt/ros/fuerte/setup.bash?