Understanding robot model (urdf) and how to move a robot

In order to get the robot moving, the xml code called the Unified Robot Description Format (URDF or urdf) has to be added with <transmission> portions. The URDF in the previous post already had <visual> and <collision> tags to describe the parts of the robot and <joint> tags describing the relation of those parts (fixed or moving), meaning that some parts are stuck to one another and other parts such as wheels can spin.

To learn more about urdf, I watched a great video by David V. Lu!! where he explains in detail the inner-workings of urdf models.

[embedyt] https://www.youtube.com/watch?v=g9WHxOpAUns[/embedyt]

One of the practical things that I noticed already while building the version 1 of the PlankDoge and David highlighted that too: the urdf models have a large number of lines of code to describe a even a simple part and its relation to other parts. In addition, the parts are not parametrized. With that I mean that the dimensions of a part are not associated in any way to other parts of the model.

Xacro was the solution that David presented. Xacro includes macros and parameters for URDF, so that you can easily use the same values (and modify them when needed) for <visual>, <collision> and <joint> tags. Creating a macro can be like creating two same hands with just one offset direction, which saves a lot of time and code writing.

Okay, what about the <transimission> tags I mentioned? The main objective is to get the robot moving and I came across ros_control package, which is a standard in ROS for controller interfaces. Turns out that David Lu!! had been involved in the development of this code. There is a Gazebo tutorial on how to use ros_control. I failed completing it because I had actually built a sdf model instead of an urdf model. I read from some forums that ros_control gets very tricky and hacky if you have an SDF. I had to learn this the hard way.

Before going into installation and usage of ros_control, I should point out that I am using Ubuntu 20.04 Focal Fossa and the ROS Noetic Ninjemeys

  1. Install ros_control and gazebo_ros:
    sudo apt-get install ros-noetic-ros-control ros-noetic-ros-controllers ros-noetic-gazebo-ros-pkgs ros-noetic-gazebo-ros-control
  2. Follow the tutorial series by David Lu!! on ROS wiki about building a robot and making it move
  3. Create package a package for your project
    catkin_create_pkg <your_package_name> gazebo_plugins gazebo_ros gazebo_ros_control controller_manager joint_state_publisher joint_state_controller robot_state_publisher rviz xacro
  4. Use urdf_sim_tutorial as a reference when developing your own robot. This package should have been installed with your ros and you can navigate to it using the command:
    roscd urdf_sim_tutorial

    There you go! With this instructions you should be able to make a movable robot using ROS and Gazebo. I’m currently working on it too. I’ll post a Github link when it is ready.

Leave a Reply

Your email address will not be published. Required fields are marked *