Loading map layers as plugins into turtlebot_navigation - sometimes works, sometimes doesn't.
UPDATE: The solution, as far as the plugins go, was to move my plugin info to a yaml file of it's own called simple_layers.yaml (so local_costmap_params.yaml is back to default). Then add a clear_params attribute to the move_base < node > tag in turtlebot_navigation/launch/includes/move_base.launch.xml. Then within this < node > tag, add <rosparam file="$(find turtlebot_navigation)/param/simple_layers.yaml" command="load" />
.
Mark clear_params as "true". When you want to load the plugins uncomment the above line. When want to unload, comment out that same line. simple_layers.yaml looks like this:
local_costmap:
plugins:
-
name: layer_simple
type: "simple_layer_namespace::SimpleLayer"
-
name: layer_grid
type: "simple_layer_namespace::GridLayer"
Hello everyone,
I have a bunch of different problems, but they're all very inter-related, so I'm going to pose them all in this one question. Here's the situation:
I created two costmap layers called layer_simple and layer_grid as per the tutorial here. I then load them into the local_costmap_params.yaml file of turtlebot_navigation/amcl_demo.launch as per the tutorials here. The idea is to have these layers added to the map_file launched by amcl_demo.launch.
The problem, in a nutshell, is that this sometimes works and sometimes doesn't. I find it easier to describe in the form of a table. Consider the following variables:
"File" refers to the event that I DO have the plugin information in my local_costmap_params.yaml file.
"Source" refers to the event that I DO run source /home/turtlebot/workspace/devel/setup.bash
where 'workspace' contains my simple_layers package. [When this event is false, or no, then /opt/ros/hydro/setup.bash is sourced].
"NotExist" refers to the event that I DO get this error (if I don't get it, the plugins load successfully and I can view them on rviz):
[ INFO] [1397144317.022246229]: Using plugin "layer_simple"
terminate called after throwing an instance of 'pluginlib::LibraryLoadException'
what(): According to the loaded plugin descriptions the class simple_layer_namespace::SimpleLayer with base class type costmap_2d::Layer does not exist. Declared types are costmap_2d::FootprintLayer costmap_2d::InflationLayer costmap_2d::ObstacleLayer costmap_2d::StaticLayer costmap_2d::VoxelLayer costmap_2d::VoxelWithFootprintLayer
[move_base-16] process has died ...
"Goal" refers to the event that I CAN run 2DNavGoal on rviz (or send goals to /move_base/goal) successfully. If I can't, I get this error:
[ WARN] [1397145188.637196407]: Clearing costmap to unstuck robot.
[ WARN] [1397145199.036562301]: Rotate recovery behavior started.
"ClassLoader" refers to the event that I DO get this error AFTER shutting down amcl_demo.launch:
Warning: class_loader.ClassLoader: SEVERE WARNING!!! Attempting to unload library while objects created by this loader exist in the heap! You should delete your objects before attempting to unload the library or destroying the ClassLoader. The library will NOT be unloaded.
Having said that, here's the table (Case 1-6 happen chronologically --> 1 before 2, etc.):
A few things to notice:
- Even when the plugins are irrelevant, as in Case 1 and 2, ClassLoader happens. When the plugins do matter as in Case 3 and 4, ClassLoader doesn't happen. So is the ...
It probably will be easiest add `clear_params="true"` to this line https://github.com/turtlebot/turtlebot_apps/blob/hydro/turtlebot_navigation/launch/includes/move_base.launch.xml#L10. I did not suggest to add rosparam delete statements to the launch file. It was rather a means to manually remove...
... them from the command line with the `rosparam` command for debugging. It is not a very scalable solution.
Just a comment on what you wrote as a solution: It should not be necessary to change clear_params to false. Just leave it as true all the time, and comment or uncomment the additional tag that you added to change between with and without your custom plugin.