2.5.1 Using Existing Models

Course subject(s) Module 2. Build your own robot environment

We’ve almost completed modifying the factory world. Now, we’ll finally place the second robot in the world by reusing a model of a UR5 created by the ROS community and learn how to import that.

To finish up the factory floor the second robot needs to be added to the world. Instead of using simple geometry to create our own robot, we will import a detailed model that was made by the ROS community. This is one of the advantages of ROS, allowing us to save time and work by using pre-existing models instead of having to create them ourselves.

In order to add the robot to the factory, the following changes need to be made to the hrwros.xacro file:

  • Import the model definition (xacro macro)
  • Add the model to the factory (instantiation)
  • Fixing it in place (joint)
  • Updating orientation

The import statement consists of a few parts:

  • The xacro:include statement itself
  • The filename attribute specifying the name of the file to import (using a package relative path)

Finally, we also need to add the macro call, which will actually instantiate the model. To prevent nameclashes, we’ll configure the new object to use a unique prefix (using the “prefix” parameter of the macro).

To connect the robot to the factory, we will connect it to the pedestal rather than the world itself. This is so that if the pedestal ever needs to be moved, the robot will move with it, rather than having to update the robot’s position manually. This is done by specifying the parent in the joint as the pedestal and the child as the robot.

Finally, the orientation needs to be corrected. This is done by adding an rpy attribute to the origin element that specifies the orientation. As ROS uses radians for angles, we’ll make use of the radians(..) convenience function which will do the conversion for us.

Creative Commons License
Hello (Real) World with ROS - Robot Operating System by TU Delft OpenCourseWare is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://online-learning.tudelft.nl/courses/hello-real-world-with-ros-robot-operating-systems//.
Back to top