Code Completion in Eclipse with pcl, ros [closed]

asked 2013-12-30 02:14:27 -0600

Juni gravatar image

updated 2014-04-20 14:09:25 -0600

ngrennan gravatar image

Hello, I'm ubuntu 12.04 , groovy user.

I'm learning pointcloud in ros and want to use Eclipse(Kepler) for IDE.

When making with catkin, Code is perfect.(didn't show any error)

But Eclipse couldn't index some codes(in pointcloud).

I made package for eclipse by following command.

catkin_make --force-cmake \
  -G"Eclipse CDT4 - Unix Makefiles" \
  -DCMAKE_BUILD_TYPE=Debug \
  -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j4

After doing this, I imported [build] folder in Eclipse.

Many red lines are appeared under code about ros, pcl.

For example, ros::init(argc, argv, "pcl_test_node"), pcl::PointXYZ point ...etc

I solved this problem with following progress.

  1. [Project]-[Properties]-[C/C++ General]-[Preprocessor Include Paths...]-[Providers] then, check [CDT GCC Build Output Parser] and [CDT GCC Built-in Compiler Settings[shared]]
  2. [Project]-[Properties]-[C/C++ Include Paths and Symbols] then, delete include path [/usr/include/eigen3]

  3. rebuild.

Finally, I removed many red lines in codes, but not in some parts of pcl.

In the next code, Eclipse couldn't index two parts.

  1. cloud->points it showed points as '?' and didn't index the members of points. and cloud->points.push_back(...) error message was 'Method 'push_back' could not be resolved'

  2. iterator iter->x = 10.0; -> red line under 'x' appear And error message was 'Field 'x' could not be resolved'

I think there may be other things I didn't realize yet.

I did many things for correcting this problem but I failed.

Any one who had same problem, please help me.

And thank for your reading in advance.

source code is here

#include <ros/ros.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl_ros/point_cloud.h>

int main(int argc, char ** argv){

    ros::init(argc,argv,"pcl_test_node");
    ros::NodeHandle nh;
    ros::NodeHandle p_nh("~");

    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>());

    for(int i=0;i<20;i++){
        cloud->points.push_back(pcl::PointXYZ(i*10.0,2.0,3.0));
    }

    pcl::PointCloud<pcl::PointXYZ>::iterator iter;

    iter = cloud->begin();

    for(;iter != cloud->end(); iter++){
        iter->x = 10.0;
    }

    while(ros::ok());
}
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tfoote
close date 2013-12-30 11:20:19

Comments

Isn't this a duplicate of http://answers.ros.org/question/113096/pointcloud-in-ros-with-eclipse/ ? If you have made progress with that question, perhaps update that one with new information? PS: your last line will do a very tight loop on `ros::ok()`: any reason not to just do `ros::spin()`?

gvdhoorn gravatar imagegvdhoorn ( 2013-12-30 02:41:36 -0600 )edit

There is no reason. It doesn't matter whether I use ok() or spin(). What I want to know is how can I import PCL Project in Eclipse.

Juni gravatar imageJuni ( 2013-12-30 17:29:03 -0600 )edit