Having trouble with custom nodelets
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 ...
now if only i could solve the segfaults from creating Publishers, I would be golden...