Ask Your Question
1

Having trouble with custom nodelets

asked 2015-07-15 13:29:23 -0500

daniel_dsouza gravatar image

updated 2015-07-16 13:29:03 -0500

Hello,

I am starting to use nodelets in my image processing pipeline, and I am having trouble loading nodelets. I am using the freenect_stack package as a sample to get started. Whether I use the nodelet loader in c++, a launch file, or command line arguments, the loader refuses to create the nodelets. I am using ROS Hydro, that I compiled from source on Ubuntu 14.04.2 LTS.

I would appreciate any help or troubleshooting steps.

Thanks, Daniel

This is the error, whether I use the command line, roslaunch, or the loader library in c++. The command line and roslaunch also say "service call failed":

Failed to load nodelet [/face_foo] of type [face_provider/face_finder]: MultiLibraryClassLoader: Could not create object of class type face_provider::face_finder as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()

This is the exported face_provider.xml file.

<library path="lib/libface_provider_nodelets">
<class name="face_provider/face_finder" type="face_provider::face_finder" base_class_type="nodelet::Nodelet">
<description>
        Finds faces in images, publishes center.
    </description></class>
<class name="face_provider/face_recognition" type="face_provider::Recognizer" base_class_type="nodelet::Nodelet"><description>
        Identifies faces in images, publishes ID.
    </description></class></library>

If I look under the ~/catkin_ws/devel/lib directory, I find the "libface_provider_nodelets.so" file, and inspecting it shows that there that looks like it loads my nodelets. This is the code I am using to load the plugins:

#include <ros/ros.h>
#include <nodelet/loader.h>

int main(int arc, char **argv) {
    ros::init(arc, argv, "face_provider_node");
    nodelet::Loader manager(true);
    //nodelet::M_string remap(ros::names::getRemappings());
    nodelet::M_string remap;
    nodelet::V_string nargv;
    std::string nodelet_name = ros::this_node::getName();
    manager.load(nodelet_name, "face_provider/face_finder", remap, nargv);
    //manager.load(nodelet_name, "face_provider/face_recognition", remap, nargv);
    ros::spin();
}

My pluginlib macros look like this:

PLUGINLIB_DECLARE_CLASS(face_provider, face_finder, face_provider::face_finder, nodelet::Nodelet);
//where the namespace is face_provider, the header file is face_finder.h, and the class name is face_finder, I was trying different class names, please excuse my syntax.

and

PLUGINLIB_DECLARE_CLASS(face_provider, face_recognition, face_provider::Recognizer, nodelet::Nodelet);
//where the namespace is face_provider, the header file is face_recognition.h, and the class name is Recognizer

EDIT: So I am going back and rewriting this from scratch (as opposed to copying code from my nodes), and I notice that once I include the opencv, imagetransport, and cv_bridge headers, the problem arises. The error code was different, complaining that it couldn't find the library path using some_path/lib//libface_provider_nodelets. Changing my face_provider.xml file changes to "liblibface_provider_nodelets" gives me the familiar "Failed to load nodelet error"

EDIT2:

So I backtracked a bit, and took most of the the openCV code out. However, whenever I include the header for the nodelet where I have opencv code, I get

[ERROR] [1437070859.100828548]: Failed to load nodelet [face_recognizer_nodelet] of type [face_provider/Recognizer]: Failed to load library /home/daniel/catkin_ws/devel/lib//libface_provider_nodelets.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro ...

(more)
edit retag flag offensive close merge delete

Comments

now if only i could solve the segfaults from creating Publishers, I would be golden...

Program received signal SIGSEGV, Segmentation fault.
0x00007fffec052819 in boost::detail::atomic_increment (pw=0xfffffffffffffff4)
at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:66
daniel_dsouza gravatar imagedaniel_dsouza ( 2015-07-16 16:01:43 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2015-07-16 16:00:17 -0500

daniel_dsouza gravatar image

A dist upgrade was not the answer.

It turns out that the undefined symbol was referring to the destructor I had used in my class. After taking out the destructor, my library loaded correctly. A constructor is needed though.

edit flag offensive delete link more

Comments

I just ran into this error message when I was passing a callback to a timer that was in the header but wasn't defined in the cpp - the compilation into a library assumed it would be provided from elsewhere so didn't error out there.

lucasw gravatar imagelucasw ( 2017-07-06 22:27:38 -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

1 follower

Stats

Asked: 2015-07-15 13:29:23 -0500

Seen: 1,983 times

Last updated: Jul 16 '15