Ask Your Question

Error while running nodelet: cannot load library, undefined symbol

asked 2011-12-09 05:39:45 -0500

Sankalp gravatar image

updated 2011-12-15 08:03:09 -0500

I am trying to create a nodelet out of an existing node with the header file gridmapping_nodelet.h given as

#include <gridmapping/gridprocess.h>
#include <missiondata/dem.h>
#include <ros/ros.h>
#include <nodelet/nodelet.h>

//namespace TX

namespace gridmapping_nodelet

  class gridmapping : public nodelet::Nodelet
     virtual void onInit();
     ros::NodeHandle * n;
     double maxrange;
     double cellsize;
     int gridsize;
     TX::GridProcess* process;

  //subcribe to pose and lidar data
     ros::Subscriber pose;
     ros::Subscriber points;
     ros::Subscriber points2;
     ros::Subscriber stereo;

  //set publish frequency
     ros::Timer obst_publish_timer;
     ros::Timer marker_publish_timer;


and gridmapping_nodelet.cpp file is as follows

     #include <gridmapping_nodelet/gridmapping_nodelet.h>
     #include <pluginlib/class_list_macros.h>

     // watch the capitalization carefully

     PLUGINLIB_DECLARE_CLASS(gridmapping_nodelet, gridmappingn,gridmapping_nodelet::gridmapping, nodelet::Nodelet)    

     using namespace gridmapping_nodelet;

       void gridmapping_nodelet::gridmapping::onInit()
           *n = getNodeHandle();
           n->getParam("/gridmapping/maxrange", maxrange);
           n->getParam("/gridmapping/cellsize", cellsize);

           gridsize = (6*maxrange)/cellsize;

           //this does the publishing and data processing
           process = new TX::GridProcess(*n, cellsize, maxrange, gridsize);
           //process = new TX::GridProcess(*n, 20, 400, 100);
           //subcribe to pose and lidar data
           pose = n->subscribe("/gridmapping/pose",0, & TX::GridProcess::updatePose, process);
           points = n->subscribe("/gridmapping/cloud", 5,& TX::GridProcess::updateGrid, process);
           points2 = n->subscribe("/gridmapping/cloud2", 5,& TX::GridProcess::updateGrid2, process);
           stereo = n->subscribe("/gridmapping/stereocloud", 5, & TX::GridProcess::updateGridStereo, process);

           //set publish frequency
           obst_publish_timer = n->createTimer(ros::Duration(0.25), &TX::GridProcess::publishObstacles, process);
           marker_publish_timer = n->createTimer(ros::Duration(0.25), &TX::GridProcess::publishMarkers, process);         


nodelet_plugins.xml is given by

<library path="lib/libgridmapping">
<class name="gridmapping_nodelet/gridmappingn" type="gridmapping_nodelet::gridmapping" base_class_type="nodelet::Nodelet">
 This is gridmapping nodelet.


rosbuild_add_library(gridmapping src/gridmapping_nodelet.cpp)


 <cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib -lgridmapping" />
 <nodelet plugin="${prefix}/nodelet_plugins.xml" />

launch file

    <node pkg="nodelet" type="nodelet" name="standalone_nodelet"  args="manager" output="screen"/>

    <node pkg="nodelet" type="nodelet" name="gridmapping" args="load gridmapping_nodelet/gridmappingn standalone_nodelet" output="screen">

The parameters are defined in a separate launch file which calls on the launch file mentioned above.

The ouput error is as follows

[ERROR] [1323458052.686296083]: Failed to load nodelet [/gridmapping] of type  [gridmapping_nodelet/gridmappingn]: Failed to load library /home/aeroscout/ros/tx_stacks/tx_perception/gridmapping_nodelet/lib/ Make sure that you are calling the PLUGINLIB_REGISTER_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Cannot load library: /home/aeroscout/ros/tx_stacks/tx_perception/gridmapping_nodelet/lib/ undefined symbol: _ZN2TX11GridProcess11updateGrid2ERKN5boost10shared_ptrIKN11sensor_msgs12PointCloud2_ISaIvEEEEE

Any help is greatly appreciated


Alright the library issue is resolved, thanks to Tully! But now I am facing md5sum errors, I have checked all my packages for consistency in terms in messages(by rebuilding them after clean) and the node I am converting to nodelet runs just fine. Since I don't change message types during conversion, I was surprised to see this error in the log file after my nodelet crashed -

     [roscpp_internal] [2011-12-15 16:26:31,390] [thread 0x7f6100734760]: [DEBUG] UDPROS server listening on port ...
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2011-12-10 10:51:12 -0500

tfoote gravatar image

You need to link the library against the library containing GridProcess symbols. If it's in another package you should add the library to the exports in the other packages manifest.xml and make sure that you depend on that package. If it's in the same package you need to use the "target_link_libraries" cmake command in you CmakeLists.txt.

edit flag offensive delete link more


Thanks for your answer, Although I was including gridmapping libraries but it had the same library name as gridmapping_nodelet and that was causing the issue above. Thanks for pointing me to the right direction
Sankalp gravatar image Sankalp  ( 2011-12-14 20:39:06 -0500 )edit

Thanks for the information. I am facing similar kind of problem (First error), even after adding the proper src file. Can you please check once?

RB gravatar image RB  ( 2014-04-27 20:48:50 -0500 )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


Asked: 2011-12-09 05:39:45 -0500

Seen: 2,906 times

Last updated: Dec 15 '11