In this post I will extend the URDF model I created in the previous post to be used to simulate a Robotis Mini robot in Gazebo ROS. I will include dynamic and other properties that are necessary for the simulation.

First, I will add collision bodies to each of the links of the URDF model. Gazebo uses the collision bodies to compute contact points / collisions between surfaces. The URDF format has two ways of defining collision bodies: as a set of geometric primitives (cubes, spheres, cylinders) or as a mesh model in stl or collada format. My first idea was to use directly the same mesh files I used for visualization (the ones provided by Robotis). However, the complexity of the computation of collisions grows with the level of detail of the collision body models (i.e. the number of triangles of the mesh model if it is not a geometric primitive). And the mesh models for visualization contain a lot of details! Using these highly detailed mesh models would slow down the simulation. Additionally, many of these details, like the holes, are useless for the collision computation.

Therefore, I used MeshLab to create a second mesh file for each robot part containing a lower resolution mesh model. Meshlab provides both a convex hull computation (for convex shapes) and the filter “Quadric Edge Collapse Decimation” that are very useful to reduce the complexity of a mesh model. I saved the simplified meshes with the same name and the suffix “_s”.

Next, I added some dynamic properties to the URDF model. To the robot links I added friction and inertial properties (mass and inertial matrix). To the robot joints I added transmissions, joint limits and maximum effort and velocity.

Then, I added the gazebo_ros_control plugin to the URDF model and defined a set of ROS controllers for the joints of the simulated robot. These controllers are loaded through a ROS controller manager node. I defined the controllers in a yaml file in the “config” folder inside the robotis_mini_control package.

 

Gazebo simulation of the Robotis Mini robot

Gazebo simulation of the Robotis Mini robot

Finally, I created a new package called robotis_mini_gazebo inside the robotis_mini_ros meta-package. This package contains a Gazebo world model and launch files to load Gazebo, the URDF model and the joint controllers. The world model is currently almost empty: it just defines a new initial viewing pose closer to the robot. I can now launch the execution of a simulation with my Robotis Mini model with the command:

roslaunch robotis_mini_gazebo gazebo_and_control.launch

Well, the simulation is up and running, I just need something to simulate! That means, I need a method that sends commands to the simulated robot, records the outcome of the execution (reward, cost) of these commands and learns the best set of parameters to achieve a task. It is getting interesting!