Home | Tutorials | Wiki | Issues
Ask Your Question
0

Multiple robots with ROS plugins (Sensor plugin vs. model plug-in)

asked 2013-10-30 15:43:00 -0500

Markus Bader gravatar image

updated 2013-10-30 15:44:21 -0500

Hi

I am using gazebo 2.0.0 and ROS hydro on Ubuntu 12.04 64bit
I like to have multiple robots within gazebo but with xacro/urdf file.
The idea was to use the name under which the robot model was spawned as prefix. This worked with some code rewriting by telling the gazebo_ros model (diffdrive) plug-in by using the physics::ModelPtr::GetName() function to access the model instance name. But the laser model uses receives a sensors::SensorPtr on Load?

  • How can I get the model instance name?
  • Is there a other way to do this?

Greetings Markus

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2013-10-31 11:57:33 -0500

jbohren gravatar image

The idea was to use the name under which the robot model was spawned as prefix.

Just about every gazebo_ros plugin supports the <robotNamespace> configuration tag. You can use this to have them create their publishers and subscribers on namespaced topics.

See here for an example: https://github.com/ros-simulation/gazeborosdemos/blob/master/rrbot_description/urdf/rrbot.gazebo#L7

edit flag offensive delete link more

Comments

1

Thanks Jonathan. But that’s not the solution I am looking for. Because I do not like to touch my xacro or sdf file after I fixed it. I just want to spawn the robot with a different model name. Using the <robotNamespace> looks to me like a design flaw or workaround.

Markus Bader gravatar imageMarkus Bader ( 2013-11-04 08:29:50 -0500 )edit

Yeah, I see what you mean. It would be interesting to standardize plugin namespacing configuration so that you could tell a sensor plugin to be scoped to the model's spawn name. I also agree that the &lt;robotNamespace&gt; tag is sort of sloppy, but I personally tend to propagate these things with xacro arguments anyway.

jbohren gravatar imagejbohren ( 2013-11-04 21:22:10 -0500 )edit
1

Yes I know that xacro is able to forward variable and therefore also the robotNamespace but people are starting to build workarounds as long as there is no standard with a documentation. Honestly thing there must be a solution for SDF otherwise it won't be used.

Markus Bader gravatar imageMarkus Bader ( 2013-11-05 04:34:59 -0500 )edit
1

While this is still a hackish solution, you don't normally need to touch the xacro/urdf file. robotNamespace is automatically added to URDF models before sending them to Gazebo: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/hydro-devel/gazebo_ros/src/gazebo_ros_api_plugin.cpp#L2119

piyushk gravatar imagepiyushk ( 2014-03-25 12:31:42 -0500 )edit

piyushk you are right, but the current (March 2014) gazeboros plugins especially the sensor plugins are not taking care of the robotNamespace. Thats way a created a pull request to get that problem fixed. https://github.com/ros-simulation/gazeboros_pkgs/pull/141

Markus Bader gravatar imageMarkus Bader ( 2014-03-28 05:06:28 -0500 )edit

@Markus Bader: I understand now. Great work on the PR. I've definitely used laser and camera with namespaces and multi-robot scenarios. The laser one with current debs is still working for me. Could you specify which sensor plugin is broken, and I'll try and reproduce the issue.

piyushk gravatar imagepiyushk ( 2014-03-28 18:04:40 -0500 )edit
0

answered 2013-11-01 18:00:46 -0500

nkoenig gravatar image

The full (aka scoped) name of a sensor is: world_name::model_name::link_name::sensor_name

That string is returned by Sensor::GetScopedName().

So, you could parse the sensor's scoped name for the model_name.

edit flag offensive delete link more

Comments

With GetScopedName() I am getting default::pioneer2dx::base_link::laser. The question is now can I assume that the model name is always the one after default?

Markus Bader gravatar imageMarkus Bader ( 2013-11-04 08:25:53 -0500 )edit

The model name always follows the world name. It is the nature of the model hierarchy.

nkoenig gravatar imagenkoenig ( 2013-11-07 15:48:16 -0500 )edit

Thanks, but now the question rises how important is it to get the model name? Should I implement in the Sensor class or in my plugin?

Markus Bader gravatar imageMarkus Bader ( 2013-11-08 06:06:30 -0500 )edit

Are you using the model name to prefix ROS topics? If so, you can get the model name inside the plugin.

nkoenig gravatar imagenkoenig ( 2013-11-13 16:28:44 -0500 )edit

Hi Nate! Worked it now out how you suggested. I made a merge request forked gazeborospkgs where I appied this changes on the gazeboroslaser sensor. I am now able to spawn on a very simple way to robots with the same xacro as shown in merge request.

Markus Bader gravatar imageMarkus Bader ( 2014-03-20 10:45:44 -0500 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2013-10-30 15:43:00 -0500

Seen: 2,464 times

Last updated: Nov 01 '13