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

Revision history [back]

click to hide/show revision 1
initial version

Hi @ARMWilkinson,

First of all, you do not need a Gazebo model just a URDF or, preferably a Xacro description. Having said that what you are doing in only loading the robot_description in the parameter server, that is the reason why only Rviz is able to see it since Rviz is reading that description from that parameter.

To be able to generate the model in Gazebo you need to call a special python script named "spawner" that it is change of generating a model in the Gaebo simulation and with the robot_description you load. I recommend you to check this tutorial to learn more about this.

To put things clear, imagine you have your robot_description and want to simulate it in Gazebo, Ideally you will have something like:

<launch>

  <arg name="model" default="$(find bilkins)/urdf/bilkins.urdf"/>
  <arg name="gui" default="true" />
  <arg name="rvizconfig" default="$(find bilkins)/rviz/urdf.rviz" />

  <!-- Coordinates to spawn model -->
  <arg name="x" default="0.0"/>
  <arg name="y" default="0.0"/>
  <arg name="z" default="0.01"/>
  <arg name="roll" default="0.0"/>
  <arg name="pitch" default="0.0"/>
  <arg name="yaw" default="0.0"/>

  <!-- Load model in parameter server -->
  <param name="robot_description" command="$(find xacro)/xacro $(arg model)" />

  <!-- Generate joint_states and tf_tree -->
  <node if="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" />
  <node unless="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="$(arg output)"
    args="-urdf -model bilkins_robot -param robot_description -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)"/>

</launch>

So in order what you have is: Load URDF in parameter server -> Generate robots TF_tree and joint_states -> Spawn model in Gazebo.

Hope this helps you.

Regards.

Hi @ARMWilkinson,

First of all, you do not need a Gazebo model just a URDF or, preferably a Xacro description. Having said that what you are doing in only loading the robot_description in the parameter server, that is the reason why only Rviz is able to see it since Rviz is reading that description from that parameter.

To be able to generate the model in Gazebo you need to call a special python script named "spawner" that it is in change of generating a model in the Gaebo Gazebo simulation and with the robot_description you load. I recommend you to check this tutorial to learn more about this.

To put things clear, imagine you have your robot_description robot_description and want to simulate it in Gazebo, Ideally you will have something like:

<launch>

  <arg name="model" default="$(find bilkins)/urdf/bilkins.urdf"/>
  <arg name="gui" default="true" />
  <arg name="rvizconfig" default="$(find bilkins)/rviz/urdf.rviz" />

  <!-- Coordinates to spawn model -->
  <arg name="x" default="0.0"/>
  <arg name="y" default="0.0"/>
  <arg name="z" default="0.01"/>
  <arg name="roll" default="0.0"/>
  <arg name="pitch" default="0.0"/>
  <arg name="yaw" default="0.0"/>

  <!-- Load model in parameter server -->
  <param name="robot_description" command="$(find xacro)/xacro $(arg model)" />

  <!-- Generate joint_states and tf_tree -->
  <node if="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" />
  <node unless="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="$(arg output)"
    args="-urdf -model bilkins_robot -param robot_description -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)"/>

</launch>

So in order So, in order, what you have is: Load URDF in parameter server -> Generate robots TF_tree TF_tree and joint_states joint_states -> Spawn model in Gazebo.

Hope this helps you.

Regards.

Hi @ARMWilkinson,

First of all, you do not need a Gazebo model just a URDF or, preferably a Xacro description. Having said that what you are doing in only loading the robot_description in the parameter server, that is the reason why only Rviz is able to see it since Rviz is reading that description from that parameter.

To be able to generate the model in Gazebo you need to call a special python script named "spawner" that it is in change of generating a model in the Gazebo simulation and with the robot_description you load. I recommend you to check this tutorial to learn more about this.

To put things clear, imagine you have your robot_description and want to simulate it in Gazebo, Ideally you will have something like:

<launch>

  <arg name="model" default="$(find bilkins)/urdf/bilkins.urdf"/>
  <arg name="gui" default="true" />
  <arg name="rvizconfig" default="$(find bilkins)/rviz/urdf.rviz" />
  <arg name="output" default="log"/>

  <!-- Coordinates to spawn model -->
  <arg name="x" default="0.0"/>
  <arg name="y" default="0.0"/>
  <arg name="z" default="0.01"/>
  <arg name="roll" default="0.0"/>
  <arg name="pitch" default="0.0"/>
  <arg name="yaw" default="0.0"/>

  <!-- Load model in parameter server -->
  <param name="robot_description" command="$(find xacro)/xacro $(arg model)" />

  <!-- Generate joint_states and tf_tree -->
  <node if="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" />
  <node unless="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

  <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="$(arg output)"
    args="-urdf -model bilkins_robot -param robot_description -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)"/>

</launch>

So, in order, what you have is: Load URDF in parameter server -> Generate robots TF_tree and joint_states -> Spawn model in Gazebo.

Hope this helps you.

Regards.