Robotics StackExchange | Archived questions

Adding a new layer to costmap for avoiding downward stairs for Operator node

Hi everyone!

I'm using ubuntu 16.04 | kinetic version | a real robot and a xbox 360 kinect v1

I'm currently struggling with adding a new layer for costmap2d that consist in detecting downward stairs. This is the package I'm using http://wiki.ros.org/depth_nav_tools. The thing is, I followed the tutorials for creating costmap_2d layers and keep getting errors like this on terminal:

load_parameters: unable to set parameters (last param was [/Mapper/LoopSearchMaximumDistance=4.0]): cannot marshal None unless allow_none is enabled.

Which means, there is one or more parameters set wrongly in one of the yaml files it uses (costmap.yaml from nav2d in my case). But it doesn't happen when I set simplelayer: scan in the declared plugin below, which shouldn't be that way, because "simplelayer:" should be empty.

I installed depth_nav_tools package correctly via catkin_make without any error by the way.

I'm using nav2d package for creating maps with my real robot and at the moment it works fine for me, but in order to recognize and avoid stairs I'm trying to use depthnavtools. I know nav2d uses the Operator node for obstacle avoidance using costmap and Karto for generating maps, so when I can add that layer correctly, I'll be able to only store downward stairs as obstacles (an array of points), but not registering them as part of the map, which is what I'm looking for.

With depthnavtools package I'm able to use three nodes and there is no problem for that, but for navlayerfrompoints. If you take a quick look at the `navlayerfrompoints` documentation, the configuration is fine and obey the requirements for creating costmap layers tutorials. So, when I add that layer for costmap.yaml file within opt/ros/kinetic/share/nav2d_tutorials/params/ as a plugin as the following:

plugins:
  - {name: simple_layer, type: "nav_layer_from_points::NavLayerPoints"}

simple_layer: {enabled: true, keep_time: 0.75, point_radius: 0.2, robot_radius: 0.4}

It executes the nodes without any error, but in the mapping mode it doesn't recognizes that layer and delivers this message after killing the set of nav2d nodes:

terminate called after throwing an instance of 'pluginlib::LibraryLoadException'
  what():  Could not find library corresponding to plugin nav_layer_from_points::NavLayerPoints. Make sure the plugin description XML file has the correct name of the library and that the library actually exists.
[Operator-1] process has died [pid 31516, exit code -6, cmd /opt/ros/kinetic/lib/nav2d_operator/operator __name:=Operator __log:=/home/neilson/.ros/log/4a1ff076-58dd-11e8-878b-3ca0672cc307/Operator-1.log].
log file: /home/neilson/.ros/log/4a1ff076-58dd-11e8-878b-3ca0672cc307/Operator-1*.log

By that reason I know it doesn't used that layer. Please, can you take a look at the operator documentation (https://github.com/skasperski/navigation_2d/tree/master/nav2d_operator) and enlighten me what could be missing.

I added the following for nav2d_operator package.xml file

  <depend>depth_nav_msgs</depend>
  <depend>dynamic_reconfigure</depend>
  <build_depend>pluginlib</build_depend>

<run_depend>pluginlib</run_depend>
<export>
   <costmap_2d plugin="${prefix}/costmap_plugins.xml" />
</export>

And costmapplugins.xml file (same as costmap2d costmapplugins.xml) for nav2doperator file, with the content:

<class_libraries>
  <library path="liblayers">
    <class type="costmap_2d::InflationLayer"  base_class_type="costmap_2d::Layer">
      <description>Inflates obstacles to speed collision checking and to make robot prefer to stay away from obstacles.</description>
    </class>
    <class type="costmap_2d::ObstacleLayer"   base_class_type="costmap_2d::Layer">
      <description>Listens to laser scan and point cloud messages and marks and clears grid cells.</description>
    </class>
    <class type="costmap_2d::StaticLayer"     base_class_type="costmap_2d::Layer">
  <description>Listens to OccupancyGrid messages and copies them in, like from map_server.</description>
    </class>
    <class type="costmap_2d::VoxelLayer"     base_class_type="costmap_2d::Layer">
      <description>Similar to obstacle costmap, but uses 3D voxel grid to store data.</description>
    </class>
  </library>
  <library path="lib/libcostmap_layers">
    <class type="nav_layer_from_points::NavLayerPoints" base_class_type="costmap_2d::Layer">
      <description>Uses points information to change the costmap</description>
    </class>
  </library>
</class_libraries>

But lib/libcostmap_layers is inside my catkinws, so my path for that layer would be `<library path="/home/myuser/catkinws/devel/lib/libcostmaplayers">`, right? I've tried that path but I keep getting the same error after launching nav2d nodes (for operator: localcostmap)

--------------------------EDIT 1 ---------------------------

I changed the path for the created costmapplugins.xml inside nav2doperator package from:

<library path="/home/neilson/catkin_ws/devel/lib/libcostmap_layers">
  <class type="nav_layer_from_points::NavLayerPoints" base_class_type="costmap_2d::Layer">
    <description>Uses points information to change the costmap</description>
  </class>
</library>

to

Uses points information to change the costmap

By copying libcostmap_layers.so into lib folder where ROS was installed (opt/ros/kinetic/lib). And now I got a similar error:

terminate called after throwing an instance of 'pluginlib::CreateClassException'
  what():  MultiLibraryClassLoader: Could not create object of class type nav_layer_from_points::NavLayerPoints as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()
[Operator-1] process has died [pid 25966, exit code -6, cmd /opt/ros/kinetic/lib/nav2d_operator/operator __name:=Operator __log:=/home/neilson/.ros/log/316adbca-58ee-11e8-878b-3ca0672cc307/Operator-1.log].
log file: /home/neilson/.ros/log/316adbca-58ee-11e8-878b-3ca0672cc307/Operator-1*.log

Why it can't create that layer and still saying that the library doesn't exist? and why is MultiLibraryClassLoader failing on that? I think I'm close.

Thanks,

Gerson N.

Asked by gerson_n on 2018-05-15 21:30:37 UTC

Comments

What does the add_library line of you CMakeLists look like?

Asked by David Lu on 2018-05-16 09:35:56 UTC

nav_layer_from_points:

add_library(costmap_layers src/costmap_layer.cpp )
add_dependencies(costmap_layers depth_nav_msgs_gencpp ${${PROJECT_NAME}_EXPORTED_TARGETS})

Operator:

add_library(RobotOperator src/RobotOperator.cpp)
target_link_libraries(RobotOperator ${catkin_LIBRARIES

Asked by gerson_n on 2018-05-16 13:17:41 UTC

Those are the unique add_library lines I found. Thanks for your answer @David Lu

Asked by gerson_n on 2018-05-16 13:18:56 UTC

There's no reason to have the libraries from costmap_2d in your costmap_plugins.xml. Does it help to remove them?

Asked by David Lu on 2018-05-16 13:32:42 UTC

Not really, after removing them it shows the same message. Maybe there is some add_library missing

Asked by gerson_n on 2018-05-16 14:10:25 UTC

lib/libNAMEOFLIBRARY is usually the correct value for path. Make sure you've compiled the package and then re-sourced the path.

Asked by David Lu on 2018-05-16 16:06:03 UTC

Ohh I see, I had a mess with the path haha. Since that doesn't make any change I'm gonna reinstall depth_nav_tools package to my catkin_ws again via catkin_make. That package it's supposed to be for kinetic, but doesn't appear for installation, althought it doesn't affect to it's functioning.

Asked by gerson_n on 2018-05-16 16:32:32 UTC

I've had the same error message for navigation with move base

  terminate called after throwing an instance of 'pluginlib::CreateClassException'
  what():  MultiLibraryClassLoader: Could not create obj...

Even after resource from the same path after reinstalling depth_nav_tools without errors :(

Asked by gerson_n on 2018-05-18 04:34:23 UTC

Answers

Please note that, from latest code branch, the class name of plugin is nav_layer_from_points::NavLayerFromPoints, costmap_plugins.xml and costmap parameter should be in same name.

Asked by zinan_ren on 2018-06-20 03:21:51 UTC

Comments