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

My nodelet won't run

asked 2017-10-16 07:43:18 -0500

Matszs gravatar image

updated 2017-10-16 11:45:58 -0500

Hello,

I'm trying to build my own Controller with help of this page ( http://wiki.ros.org/kobuki/Tutorials/... ) which helps you create a nodelet.

Now have I tried a few things:

  • Write my own, which looks like the 'random_walker' from git ( https://github.com/yujinrobot/kobuki/... )
  • Copied the random_walker source and change all the names
  • And tried to create it from the tutorial.

Every time I get stuck on the same point, when I want to launch my nodelet I get this error:

Failed to load nodelet [/drive_controller] of type [kobuki_autonome/DriveControllerNodelet] even after refreshing the cache: According to the loaded plugin descriptions the class kobuki_autonome/DriveControllerNodelet with base class type nodelet::Nodelet does not exist. Declared types are  depth_image_proc/convert_metric depth_image_proc/crop_foremost depth_image_proc/disparity depth_image_proc/point_cloud_xyz depth_image_proc/point_cloud_xyz_radial depth_image_proc/point_cloud_xyzi depth_image_proc/point_cloud_xyzi_radial depth_image_proc/point_cloud_xyzrgb depth_image_proc/register image_proc/crop_decimate image_proc/crop_nonZero image_proc/crop_non_zero image_proc/debayer image_proc/rectify image_proc/resize image_publisher/image_publisher image_rotate/image_rotate image_view/disparity image_view/image kobuki_auto_docking/AutoDockingNodelet kobuki_bumper2pc/Bumper2PcNodelet kobuki_controller_tutorial/BumpBlinkControllerNodelet kobuki_node/KobukiNodelet kobuki_random_walker/RandomWalkerControllerNodelet kobuki_safety_controller/SafetyControllerNodelet nodelet_tutorial_math/Plus pcl/BAGReader pcl/BoundaryEstimation pcl/ConvexHull2D pcl/CropBox pcl/EuclideanClusterExtraction pcl/ExtractIndices pcl/ExtractPolygonalPrismData pcl/FPFHEstimation pcl/FPFHEstimationOMP pcl/MomentInvariantsEstimation pcl/MovingLeastSquares pcl/NodeletDEMUX pcl/NodeletMUX pcl/NormalEstimation pcl/NormalEstimationOMP pcl/NormalEstimationTBB pcl/PCDReader pcl/PCDWriter pcl/PFHEstimation pcl/PassThrough pcl/PointCloudConcatenateDataSynchronizer pcl/PointCloudConcatenateFieldsSynchronizer pcl/PrincipalCurvaturesEstimation pcl/ProjectInliers pcl/RadiusOutlierRemoval pcl/SACSegmentation pcl/SACSegmentationFromNormals pcl/SHOTEstimation pcl/SHOTEstimationOMP pcl/SegmentDifferences pcl/StatisticalOutlierRemoval pcl/VFHEstimation pcl/VoxelGrid stereo_image_proc/disparity stereo_image_proc/point_cloud2 yocs_cmd_vel_mux/CmdVelMuxNodelet yocs_velocity_smoother/VelocitySmootherNodelet

And I can't solve this. I have read about a mistaken path in the 'nodelet_plugins.xml', but that is not the case:

<library path="lib/libdrive_controller_nodelet">
<class name="kobuki_autonome/DriveControllerNodelet" type="kobuki::DriveControllerNodelet" base_class_type="nodelet::Nodelet">
    <description>
        Nodelet for a simple blink when bump controller
    </description>
</class>
</library>

So can somebody help me?

Platform: Kobuki Kinetic

Updated: Added the code from pastebin into my post

CMakeLists:

cmake_minimum_required(VERSION 2.8.3)
project(kobuki_autonome)
find_package(catkin REQUIRED COMPONENTS roscpp
                                        nodelet
                                        pluginlib
                                        std_msgs
                                        kobuki_msgs
                                        yocs_controllers)

catkin_package(INCLUDE_DIRS include
               LIBRARIES drive_controller_nodelet
               CATKIN_DEPENDS roscpp
                              nodelet
                              pluginlib
                              std_msgs
                              kobuki_msgs
                              yocs_controllers)

include_directories(include
                    ${catkin_INCLUDE_DIRS})

add_library(drive_controller_nodelet src/nodelet.cpp)
add_dependencies(drive_controller_nodelet ${catkin_EXPORTED_TARGETS})
target_link_libraries(drive_controller_nodelet ${catkin_LIBRARIES})

install(TARGETS drive_controller_nodelet
        DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(DIRECTORY include/${PROJECT_NAME}/
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

install(DIRECTORY plugins
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

install(DIRECTORY launch
        DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

plugins/nodelet_plugins.xml:

<library path="lib/libdrive_controller_nodelet">
    <class name="kobuki_autonome/DriveControllerNodelet" type="kobuki::DriveControllerNodelet" base_class_type="nodelet::Nodelet">
        <description>
            Nodelet test
        </description>
    </class>
</library>

src/nodelet.cpp:

#include <nodelet/nodelet.h>
#include <pluginlib/class_list_macros.h>
#include "kobuki_autonome/drive_controller.hpp"


namespace kobuki
{

/**
 * @brief Nodelet-wrapper of the BumpBlinkController class
 */
class DriveControllerNodelet : public nodelet::Nodelet
{
public:
  DriveControllerNodelet(){};
  ~DriveControllerNodelet(){}

  /**
   * @brief Initialise the nodelet
   *
   * This function is called, when the nodelet manager loads the nodelet.
   */
  virtual void onInit()
  {
    ros::NodeHandle nh = this->getPrivateNodeHandle();

    // resolve node(let) name
    std::string name = nh.getUnresolvedNamespace();
    int pos = name.find_last_of('/');
    name = name.substr(pos + 1);

    NODELET_INFO_STREAM("Initialising nodelet... [" << name << "]");
    controller_.reset(new DriveController(nh, name));

    // Initialises the controller
    if (controller_->init())
    {
      NODELET_INFO_STREAM("Nodelet initialised. [" << name << "]");
    }
    else
    {
      NODELET_ERROR_STREAM("Couldn't initialise nodelet! Please ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-10-17 06:48:25 -0500

Matszs gravatar image

The problem is fixed. In the package.xml I removed the following lines:

<run_depend>pluginlib</run_depend>
<build_depend>pluginlib</build_depend>

And in the CMakeLists.txt remove the lines with 'pluginlib' in it.

And it worked...

edit flag offensive delete link more

Comments

I'm not sure why that is a fix to your issue...After making the changes you mentioned, 1) have you re-installed dependencies? 2) have you rebuilt the workspace?

130s gravatar image 130s  ( 2017-10-17 11:47:57 -0500 )edit
1

answered 2017-10-16 09:02:16 -0500

130s gravatar image

nodelet involves multiple files, so it's not straightforward. Sharing CMakeLists.txt, your code (especially the line you're exporting your class using pluginlib's mechanism if you're writing your nodelet in C++).

That said, your issue is likely FAQ, as I hit many other threads on google. I'd suggest checking the name of the lib file and the class name.

edit flag offensive delete link more

Comments

Thank you for your reply, I have also seen this topics on Google and I have checked if the names are correct and they are.

Matszs gravatar image Matszs  ( 2017-10-16 13:37:34 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-10-16 07:43:18 -0500

Seen: 1,263 times

Last updated: Oct 17 '17