Ask Your Question
0

Loading map layers as plugins into turtlebot_navigation - sometimes works, sometimes doesn't.

asked 2014-04-10 11:04:54 -0500

oswinium gravatar image

updated 2014-04-16 08:03:39 -0500

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

image description

A few things to notice:

  1. 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 ...
(more)
edit retag flag offensive close merge delete

Comments

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

demmeln gravatar imagedemmeln ( 2014-04-15 07:22:27 -0500 )edit

... them from the command line with the `rosparam` command for debugging. It is not a very scalable solution.

demmeln gravatar imagedemmeln ( 2014-04-15 07:22:55 -0500 )edit
1

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.

demmeln gravatar imagedemmeln ( 2014-04-16 06:56:17 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-04-11 00:04:35 -0500

demmeln gravatar image

How are you running your trials? In particular, ros parameters are in general not cleared from the parameter server. So if you "take out" parameters from the yaml file, they might still be present on the parameter server. There are multiple ways to deal with this.

  1. Restart roscore in between your trials, which also restarts the parameter server. This is the sledgehammer method that should always work, but might be inconvenient.
  2. Manually remove the parameters with rosparam or with according commands in the launch file.
  3. Use the clear_params attribute to the node tag in your launch files. This clears the private namespace of a node before launch. Depending on how you load parameters, this might not work. http://wiki.ros.org/roslaunch/XML/node
  4. Use anonymous node name. This way the name is different for each run and you can be sure there are no 'stale' parameters. This and the previous solution don't do anything about global parameters, but I think in your case it is only about private ones.

I suggest making sure stale parameters of previous runs don't affect you any more, and then try again and see if it makes more sense.

edit flag offensive delete link more

Comments

Thanks, I'll give those a shot. In the mean time, could you shed some light on points 1 and 3 in MY post (not your answer) i.e. about the ClassLoader error and about using turtlebot_navigation for my purposes... Again, thanks!

oswinium gravatar imageoswinium ( 2014-04-11 04:25:59 -0500 )edit

For your methods, @demmeln, only method 1 works so far. Methods 3 and 4 require me to have my own node; all I have are two .cpp libraries defined in my simple_layers package. Do these count as nodes?

oswinium gravatar imageoswinium ( 2014-04-11 10:08:11 -0500 )edit

@demmeln, just wondering if you saw the latest edits and comments? :) Thank you for your time, sir.

oswinium gravatar imageoswinium ( 2014-04-15 06:28:43 -0500 )edit

No, 3. and 4. do not require you to write your own nodes. You just need to edit the launch files where the nodes are started, but you are doing that already, so where is the problem?

demmeln gravatar imagedemmeln ( 2014-04-15 06:47:14 -0500 )edit

I am running this launch file: http://bit.ly/P3kMNl exactly as it is. The changes I *have* made are in move_base.launch.xml as described in the EDIT portion of my question. The problem is that methods 3 and 4 require a <node> tag which (I think) is n/a over here :S Unless I'm mistaken.

oswinium gravatar imageoswinium ( 2014-04-15 07:04:34 -0500 )edit

You will need to edit this file: https://github.com/turtlebot/turtlebot_apps/blob/hydro/turtlebot_navigation/launch/includes/move_base.launch.xml . There is the node tag for move_base. Try the clear_params.

demmeln gravatar imagedemmeln ( 2014-04-15 07:17:42 -0500 )edit

Yes, but wouldn't that also clear the other parameters like local and global costmap? I only want to remove the plugins I ADDED :)

oswinium gravatar imageoswinium ( 2014-04-15 07:34:55 -0500 )edit

It clears all those parameters, but then the rosparam tags inside the node tag make sure to add them again.

demmeln gravatar imagedemmeln ( 2014-04-15 09:34:53 -0500 )edit
-1

answered 2014-04-10 20:05:45 -0500

Ken_in_JAPAN gravatar image

Excuse me, May I ask you if you have executed the next command?

echo $ROS_PACKAGE_PATH

I guess that your issue has relation to the fact that your computer can't find your source. I think you should add following to .bashrc.

  export ROS_PACKAGE_PATH=~/workspace/src

More detail is described on this web ( http://wiki.ros.org/ROS/EnvironmentVa... ). I hope your issue is going out.

edit flag offensive delete link more

Comments

It appears the OP is using catkin. With catkin you should usually not manually change ROS_PACKAGE_PATH as needed for rosbuild.

demmeln gravatar imagedemmeln ( 2014-04-10 23:57:47 -0500 )edit

Yes, you are right, I am using catkin.

oswinium gravatar imageoswinium ( 2014-04-11 05:44:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2014-04-10 11:04:54 -0500

Seen: 1,580 times

Last updated: Apr 16 '14