nodelet doesn't start
Hi all,
I try to implement a nodelet, which should be used for extracting (SIFT-)features. The data should come from a kinect camera (Openni and our features/descriptor extractor should run in one process). I used the tutorial from http://www.ros.org/wiki/nodelet , but it doesn't work.
The first thing I did was to create a class, which is derived from nodelet::Nodelet (feature_nodelet.h):
#ifndef FEATURE_NODELET_H_
#define FEATURE_NODELET_H_
#include <nodelet/nodelet.h>
namespace rgbdslam {
class FeatureNodelet: public nodelet::Nodelet {
public:
virtual ~FeatureNodelet() {}
private:
void onInit();
};
}
#endif /* FEATURE_NODELET_H_ */
feature_nodelet.cpp contains the plugin-lib-macro:
#include <ros/ros.h>
#include <pluginlib/class_list_macros.h>
#include "feature_nodelet.h"
#include "parameter_server.h"
#include "extractor_nodelet.h"
namespace rgbdslam {
PLUGINLIB_DECLARE_CLASS(rgbdslam, FeatureNodelet, rgbdslam::FeatureNodelet, nodelet::Nodelet);
void FeatureNodelet::onInit() {
ros::NodeHandle& nh = getNodeHandle();
ParameterServer* params = ParameterServer::instance();
//some test output
NODELET_INFO_STREAM("test");
NODELET_ERROR("test");
ROS_ERROR("test");
ExtractorNodelet features(nh,
params->get<std::string> ("topic_image_mono").c_str(),
params->get<std::string> ("topic_image_depth").c_str(),
params->get<std::string> ("topic_points").c_str(),
params->get<std::string> ("feature_extractor_type").c_str(),
params->get<std::string> ("feature_detector_type").c_str());
}
}
In manifest.xml I added the export of the nodelet xml file (and the nodelet-dependency):
<export>
<nodelet plugin="${prefix}/nodelet.xml" />
</export>
nodelet.xml:
<library path="lib/libfeature_nodelet">
<class name="rgbdslam/FeatureNodelet" type="rgbdslam::FeatureNodelet" base_class_type="nodelet::Nodelet">
<description>
RGBDSlam feature extraction and sending pointclouds / descriptors
</description>
</class>
</library>
Finally the CMakeLists.txt contains the command for compiling the library:
rosbuild_add_library(feature_nodelet src/feature_nodelet.cpp src/extractor_nodelet.cpp src/parameter_server.cpp)
Now, if I use the launch-file
<launch>
<!-- kinect-->
<node pkg="nodelet" type="nodelet" name="openni_manager" output="screen" respawn="true" args="manager"/>
<node pkg="nodelet" type="nodelet" name="openni_camera" args="load openni_camera/OpenNINodelet openni_manager" respawn="true"/>
<!-- Kinect frames -->
<include file="$(find openni_camera)/launch/kinect_frames.launch"/>
<node pkg="nodelet" type="nodelet" name="feature_extractor" args="load rgbdslam/FeatureNodelet openni_camera" output="screen" />
<node pkg="rgbdslam" type="rgbdslam" name="rgbdslam" cwd="node" required="false" output="log" />
</launch>
it seems, that the feature_extractor nodelet will not be called. I tried some output (ROS_ERROR() and NODELET_ERROR()) in the onInit-method, but nothing happened.
However the openni nodelet is working and feature_extractor nodelet appears in the (rx)graph. It only has a connection to /rosout.
Are there any further steps, I must perform to use the feature_extractor nodelet. Or will a nodelet only get active (i.e. onInit() is called) , if some other nodes subscribe a topic, which is advertised by the nodelet?
Edit 1: I forgot to say, that I've tested openni_manager in
<[...] args="load rgbdslam/FeatureNodelet openni_manager" output="screen" />
In this case there was an error: something like "ROS cannot find the nodelet". At the moment I cannot get the error-message remotely, since the kinect isn't conntected to the computer at university. But it seems, that the error only appears, if there is no kinect connected, which leads to the following (rx)graph:
Nevertheless, there is no output (e.g. ROS_ERROR/NODELET_ERROR in onInit) in the log/console, i.e. onInit wasn't called.
Edit 2: Now, after ...
how did you insert picture in your question?
@Sudhan: he used markdown of this form: "
![rxgraph](http://danielkuhner.de/fileadmin/uni/ros/rxgraph.png)
"