ROS tests with robot description

What is the best way to write tests that require a robot description? Are there any simple xacro files for testing or even a parametrizable robot description?

An example of such a test would be a ROS node which collects the current joint state and represents them in a model for use in a model view. This node requires the robot description to know about the available joints and then is updated frequently with joint_states messages.

1 Like

This sounds like what rostest is for.

If you’re not aware, rostests are basically launch files, but launched by a special roslaunch wrapper that is specifically intended to be able to test nodes in a (mini) application context.

Populating the robot_description parameter (or any parameter really) is done in exactly the same way as you would in a regular launch file.

This node requires the robot description to know about the available joints and then is updated frequently with joint_states messages.

The rostest could also start a second node that generates those joint states.


Edit: perhaps interesting: wiki/Quality/Tutorials/UnitTesting.

Yes I’m aware of rostest and also about the possibility of loading a robot_description via launch file.

However, what I’m looking for is some kind of “standard” robot description that can be used for testing.

My apologies. I’d somehow completely missed you were actually asking about/for a suitable xacro/urdf for testing, instead of how to test.

Are there any simple xacro files for testing or even a parametrizable robot description?

I’m not entirely sure I understand what you are asking for, but nodes such as joint_state_publisher include a nr of small urdfs that are used in the tests that accompany it. See ros/joint_state_publisher/joint_state_publisher/test. The test suite for xacro is another: ros/xacro/test.

I am not sure if this is what you are looking for… but I created generic xacro files for testing description of different components in our lab.

I call this script with different parameters from a roslaunch test file. this is just test for parsing and if you want one can test also the description in rviz.

<?xml version="1.0"?>
<launch>
    <arg name="type" default="tools"/>
    <arg name="object_to_test" default="measurement_tool"/>

  <!-- send urdf to param server -->
  <param name="object_description" command="$(find xacro)/xacro --inorder '$(find iirob_description)/$(arg type)/urdf/$(arg object_to_test)/test_$(arg object_to_test).urdf.xacro'"/>

  <!-- robot state publisher -->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="tool_state_publisher">
      <param name="publish_frequency" type="double" value="50.0" />
      <remap from="robot_description" to="object_description" />
  </node>

  <node pkg="rviz" type="rviz" args="-d $(find iirob_description)/common/rviz/test_objects.rviz" name="test_objects" required="true">
  </node>

</launch>

If you want to test robots with non-static joints you could use something like this:

<?xml version="1.0"?>
<launch>

  <arg name="pkg" default="iirob_kuka_bringup"/>
  <arg name="file_name" default="r5"/>

  <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find iirob_kuka_bringup)/urdf/$(arg file_name).urdf.xacro'" />

  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >
    <param name="use_gui" value="true"/>
  </node>

  <!-- robot state publisher -->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="tool_state_publisher">
      <param name="publish_frequency" type="double" value="50.0" />
  </node>

  <node name="test_robots" pkg="rviz" type="rviz" args="-d $(find iirob_description)/common/rviz/test_robots.rviz" />

</launch>

I hope this can help you further…

2 Likes

Thanks, that’s what I was looking for. Can I find the iirob_description package somewhere?

You can download a version of this package here.

I deleted all meshes and urdf files since they are currently not public.

1 Like