Ask Your Question
0

Error while running nodelet: cannot load library, undefined symbol

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

Sankalp gravatar image

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

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

#ifndef GRIDMAPIING_NODELET_H
#define GRIDMAPIING_NODELET_H
#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
  {
     public:
     gridmapping(){};
     virtual void onInit();
     ~gridmapping();
     private:
     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;
  };
};
//};

#endif

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">
<description>
 This is gridmapping nodelet.
</description>
</class>
</library>

CMakeLists.txt

rosbuild_add_library(gridmapping src/gridmapping_nodelet.cpp)

manifest.xml

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

launch file

  <launch>
    <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">
    </node>                 
  </launch>

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/libgridmapping.so. 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/libgridmapping.so: undefined symbol: _ZN2TX11GridProcess11updateGrid2ERKN5boost10shared_ptrIKN11sensor_msgs12PointCloud2_ISaIvEEEEE

Any help is greatly appreciated

EDIT 1

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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-12-10 10:51:12 -0600

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

Comments

1
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 imageSankalp ( 2011-12-14 20:39:06 -0600 )edit
1

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? http://answers.ros.org/question/157886/error-while-loading-nodelet-velocity_multiplexer/

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

Stats

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

Seen: 2,651 times

Last updated: Dec 15 '11