ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

nodelet doesn't start

asked 2011-05-26 23:10:14 -0600

Daniel Kuhner gravatar image

updated 2011-06-02 22:08:53 -0600

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:

rxgraph

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 ...

(more)
edit retag flag offensive close merge delete

Comments

Did Ivan's solution not work for you?
Asomerville gravatar image Asomerville  ( 2011-05-31 04:36:58 -0600 )edit
No, the solution not worked for me. The rxgraph looks better, but I got an error (see question)...
Daniel Kuhner gravatar image Daniel Kuhner  ( 2011-05-31 19:23:52 -0600 )edit
I updated my post.
Ivan Dryanovski gravatar image Ivan Dryanovski  ( 2011-06-01 01:00:40 -0600 )edit

how did you insert picture in your question?

Sudhan gravatar image Sudhan  ( 2012-10-08 23:39:28 -0600 )edit
1

@Sudhan: he used markdown of this form: "![rxgraph](http://danielkuhner.de/fileadmin/uni/ros/rxgraph.png)"

Asomerville gravatar image Asomerville  ( 2012-10-09 04:13:40 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
3

answered 2011-06-09 15:40:42 -0600

tfoote gravatar image

Based on Edit 2: Your nodelet is not correctly being exported. Did you create two export blocks in the manifest? You can only have one.

edit flag offensive delete link more

Comments

That's it. There was a second export in the manifest. Thank you!
Daniel Kuhner gravatar image Daniel Kuhner  ( 2011-06-14 19:38:51 -0600 )edit
3

answered 2012-11-11 12:57:32 -0600

IvanShindev gravatar image

This post may be outdated but I had the same problem recently. Make sure that in your manifest.xml file you have <depend package="nodelet"/>. Run "rospack plugins --attrib=plugin nodelet" and make sure your plugin is showing. Your plugin should show even if the package is not made, as long as you export it in the manifest.xml file and have the nodelet packete declared as a dependency.

edit flag offensive delete link more

Comments

this really helps. Thanks.

clark gravatar image clark  ( 2012-12-07 22:16:36 -0600 )edit
2

answered 2011-05-26 23:26:12 -0600

updated 2011-06-01 02:21:24 -0600

It looks to me like

<[...] args="load rgbdslam/FeatureNodelet openni_camera" output="screen" />

needs to be changed to

<[...] args="load rgbdslam/FeatureNodelet openni_manager" output="screen" />

EDIT 1

Well, everything looks like it should work. The error you're getting means the nodelet was never exported properly - it's not on the list of nodelets that ROS knows about. What is the output when you compile rgbdslam?

Also, if I can take a look at the whole .cpp, .h, CMakeList and .xml files, I might be able to help further

EDIT 2

There's a closing bracket missing in the rosbuild_add_library line - is that how it got displayed here, or also in your file?

edit flag offensive delete link more

Comments

@Edit 2: The missing bracket was caused by a c&p or display error. The original file contains a bracket.
Daniel Kuhner gravatar image Daniel Kuhner  ( 2011-06-02 22:16:20 -0600 )edit

Question Tools

Stats

Asked: 2011-05-26 23:10:14 -0600

Seen: 4,374 times

Last updated: Nov 11 '12