Ask Your Question
0

Cmake error during building a rospackage

asked 2018-04-27 00:59:56 -0600

aditya369007 gravatar image

Hello all

I am trying to learn how to use the ROS-PCL library with the Velodyne 64E lidar. I have stored my code in the same directory as that of the Velodyne_height_map project and I want to modify the existing CMakeList.txt file to incorporate my own code. My main goal is to find the distances of the obstacles by subscribing to the velodyne_obstacles topic.

This is the error I am getting when I am building the project.

>  *** No rule to make target
> '/usr/lib/x86_64-linux-gnu/libpthread.so/opt/ros/kinetic/lib/libpcl_ros_filters.so',
> needed by
> '/home/aditya/catkin_ws/devel/lib/velodyne_height_map/myheight'.
> Stop.

This is the addition I have done to the CMakeLists.txt file by following few tutorials.

add_executable(myheight src/my_height_sub.cpp)
target_link_libraries(myheight ${catkin_LIBRARIES}${catkin_LIBRARIES}
                      ${Boost_LIBRARIES}
                      ${PCL_LIBRARIES})

This is the program I am trying to run.

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

typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;

void callback(const sensor_msgs::PointCloud2ConstPtr&);


int main(int argc, char** argv)
{
    ros::NodeHandle nh;
    std::string topic = nh.resolveName("point_cloud");
    uint32_t queue_size = 1;


    // to create a subscriber, you can do this (as above):
    ros::Subscriber sub = nh.subscribe<sensor_msgs::PointCloud2> ("velodyne_points", queue_size, callback);
}

I know I am missing some dependencies in the CMakelists, but cant seem to figure out what they are. Can someone help me out please? Many thanks in advance!

edit retag flag offensive close merge delete

Comments

I'm no expert on this, but it seems that pcl_ros_filter (which is in your error message) cannot be used. Why this should be linked, however, I don't know. I don't see anything apparent relating to that.

mgruhler gravatar image mgruhler  ( 2018-04-27 01:14:23 -0600 )edit

Thats what I am unable to understand, I have not used pcl_ros_filter still this is showing up. But I have still added ${PCL_ROS_FILTER} in the link libraries, but still I am facing the same error.

aditya369007 gravatar image aditya369007  ( 2018-04-27 01:21:21 -0600 )edit

Can you paste the entire CMakeList.txt(without the comments)?

robotchicken gravatar image robotchicken  ( 2018-04-27 01:25:56 -0600 )edit

pastebin

It is attached here

aditya369007 gravatar image aditya369007  ( 2018-04-27 01:35:58 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-27 02:07:45 -0600

robotchicken gravatar image

updated 2018-04-27 02:11:44 -0600

/usr/lib/x86_64-linux-gnu/libpthread.so/opt/ros/kinetic/lib/libpcl_ros_filters.so This path seems super wierd. Can you paste the result of "echo $LD_LIBRARY_PATH" on you terminal.

Was this a CmakeList.txt file written by you? can you try changing to:

target_link_libraries(
          myheight
          ${catkin_LIBRARIES}
          ${Boost_LIBRARIES}
          ${PCL_LIBRARIES} 
)
edit flag offensive delete link more

Comments

In function main': /home/aditya/catkin_ws/src/velodyne_height_map/src/my_height_sub.cpp:16: undefined reference tocallback(boost::shared_ptr<sensor_msgs::pointcloud2_<std::allocator<void> > const> const&)'

I got this error now I think its a programming error. Will rectify it

aditya369007 gravatar image aditya369007  ( 2018-04-27 02:11:33 -0600 )edit

And no this was not written by me

aditya369007 gravatar image aditya369007  ( 2018-04-27 02:11:56 -0600 )edit

Yup, i think you need to define the function callback.

robotchicken gravatar image robotchicken  ( 2018-04-27 02:18:30 -0600 )edit

Mark as resolved if it works out.

robotchicken gravatar image robotchicken  ( 2018-04-27 02:35:09 -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: 2018-04-27 00:59:56 -0600

Seen: 233 times

Last updated: Apr 27 '18