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

Is URDF plugin's namespace different from topic's namespace?

asked 2021-07-18 21:55:47 -0600

electrophod gravatar image

updated 2021-07-18 22:08:26 -0600

If I spawn a URDF using the spawn_model node in the gazebo_ros package in a separate namespace called ns1 using the <group ns="ns1"> tag, would all the topics related to the URDF (controller topics, plugin topics, sensor topics) be also be launched in the ns1 namespace or would they be there in the global namespace?

I tried doing it and found them to be present in the global namespace, I'm not sure if I'm doing it correctly. Wouldn't it make more sense for them to be present in the namespace in which the node spawning them is launched?

Also, it'd be great if someone points me to some example repos in which multiple robots of the same kind (preferably with cameras or other sensors) are simulated in a Gazebo simulation. I want to check how to take care of topic namespaces, plugins, and transforms.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-07-21 17:46:44 -0600

Youssef_Lah gravatar image

Here is what I did for namespace and it's working well:

In a file robots.launch: (here I show you only the group tag)

<!-- Launch gazebo -->
<include file="$(find your_package)/launch/gazebo.launch">
  <arg name="model" value="$(arg model)"/>

<group ns="robot1">
    <param name="tf_prefix" value="robot1_tf" />
    <include file="$(find your_package)/launch/robot.launch" >
      <arg name="init_pose" value="-x 11 -y 11 -z 0" />
      <arg name="robot_name"  value="robot1" />

Then in robot.launch: (here is the full file)

    <arg name="robot_name" default="rrr"/>
    <arg name="init_pose" default="rrr"/>

    <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
         args="$(arg init_pose) -urdf -param /robot_description -model $(arg robot_name)"
         respawn="false" output="screen" />

        <node pkg="robot_state_publisher" type="robot_state_publisher" 
              name="robot_state_publisher" output="screen"/>


Then in gazebo.launch: (full file)

<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="model" default="$(find your_package)/urdf/robot.urdf.xacro"/>

<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find your_package)/world/world2"/>
<arg name="verbose" value="true" />
<arg name="debug" value="$(arg debug)" />
<arg name="gui" value="$(arg gui)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
<param name="robot_description" command="$(find xacro)/xacro  $(arg model)"/>

example of diff_drive plugin:

  <plugin name="differential_drive_controller" filename="">
edit flag offensive delete link more

Question Tools



Asked: 2021-07-18 21:55:47 -0600

Seen: 700 times

Last updated: Jul 21 '21