Ask Your Question
0

Eigen/Core on ROS hydro

asked 2014-07-10 17:22:28 -0600

lucaluca gravatar image

updated 2014-07-14 15:00:26 -0600

I'm trying to follow this tutorial using ROS hydro medusa:

/laser_pipeline/Tutorials/IntroductionToWorkingWithLaserScannerData

The code won't compile saying that:

/opt/ros/hydro/include/laser_geometry/laser_geometry.h:46:22: fatal error: Eigen/Core: No such file or directory

I could only find a guide for a migration to ROS fuerte, but those instructions didn't work for me. Does anybody know how to fix this?


EDIT to add details: I created a new package with dependences on roscpp, rospy (probably useless) and std_msgs. I'm using ROS hydro medusa. I then created a cpp source containing this code:

#include "ros/ros.h"
#include "tf/transform_listener.h"
#include "sensor_msgs/PointCloud.h"
#include "tf/message_filter.h"
#include "message_filters/subscriber.h"
#include "laser_geometry/laser_geometry.h"

class LaserScanToPointCloud{

public:

  ros::NodeHandle n_;
  laser_geometry::LaserProjection projector_;
  tf::TransformListener listener_;
  message_filters::Subscriber<sensor_msgs::LaserScan> laser_sub_;
  tf::MessageFilter<sensor_msgs::LaserScan> laser_notifier_;
  ros::Publisher scan_pub_;

  LaserScanToPointCloud(ros::NodeHandle n) : 
    n_(n),
    laser_sub_(n_, "base_scan", 10),
    laser_notifier_(laser_sub_,listener_, "base_link", 10)
  {
    laser_notifier_.registerCallback(
      boost::bind(&LaserScanToPointCloud::scanCallback, this, _1));
    laser_notifier_.setTolerance(ros::Duration(0.01));
    scan_pub_ = n_.advertise<sensor_msgs::PointCloud>("/my_cloud",1);
  }

  void scanCallback (const sensor_msgs::LaserScan::ConstPtr& scan_in)
  {
    sensor_msgs::PointCloud cloud;
    try
    {
        projector_.transformLaserScanToPointCloud(
          "base_link",*scan_in, cloud,listener_);
    }
    catch (tf::TransformException& e)
    {
        std::cout << e.what();
        return;
    }

    // Do something with cloud.

    scan_pub_.publish(cloud);

  }
};

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

  ros::init(argc, argv, "my_scan_to_cloud");
  ros::NodeHandle n;
  LaserScanToPointCloud lstopc(n);

  ros::spin();

  return 0;
}

At this point, I added these two lines at the end of CMakeLists.txt as I always did with sources:

add_executable(laser_scan_to_point_cloud src/laser_scan_to_point_cloud.cpp)
target_link_libraries(laser_scan_to_point_cloud ${catkin_LIBRARIES})

However, I'm getting the error that I told you when I try to compile with catkin_make. I tried to use rosdep, but it says that all the dependencies have been correctly installed. I also tried with an offline roswtf, but it doesn't find anything. Here are the versions:

rosversion -d: hydro

rosversion roscpp: 1.10.2

rosversion laser_geometry: 1.5.15

rosversion std_msgs: 0.5.8

Please let me know if you need other information!

edit retag flag offensive close merge delete

Comments

Please provide more context as to how to reproduce your problem. Those should be system libraries installed on your computer as a dependency of the package where the file is erroring. It could be something like you're overriding the include path.

tfoote gravatar imagetfoote ( 2014-07-10 19:18:09 -0600 )edit

Thanks for your help. I added all the details that came to my mind. If you need other please let me know. As far as I know, the problem is that I'm missing the "eigen" package, but the point is that that package isn't available since ROS fuerte, since you can find migration instructions TO fuerte

lucaluca gravatar imagelucaluca ( 2014-07-11 07:54:56 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-07-11 10:58:50 -0600

allenh1 gravatar image

If you're using Ubuntu, then do the following.

sudo apt-get install libeigen3-dev

Otherwise, you can always build from source.

~ $ wget http://bitbucket.org/eigen/eigen/get/3.2.1.tar.bz2
~ $ tar -xjf 3.2.1.tar.bz2
~ $ cd eigen-eigen-6b38706d90a9
~/eigen-eigen-6b38706d90a9 $ mkdir build && cd build && cmake ../
~/eigen-eigen-6b38706d90a9 $ sudo make install
~/eigen-eigen-6b38706d90a9 $ sudo ldconfig

After you've installed eigen (hopefully the first way), you should be able to build the code. Unless some other dependency pops up... In which case, feel free to comment.

edit flag offensive delete link more

Comments

Thank you for your help! I'm now getting an even stranger error now. Let me know if you can help me. EDIT: I added the new error at the end of my original question

lucaluca gravatar imagelucaluca ( 2014-07-13 08:19:54 -0600 )edit

@allenh1 my fault, I forgot to import the tf library. Thanks a lot!! :)

lucaluca gravatar imagelucaluca ( 2014-07-14 14:59:51 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-07-10 17:22:28 -0600

Seen: 1,808 times

Last updated: Jul 14 '14