Simulating with Gazebo and ROS
My various tests with ROS quickly led me to the conclusion that it was essential to build a model for simulating gribot.org">gribot with Gazebo and ROS.org">ROS. This makes it possible to experiment without risk, as well as to test the various ROS.org">ROS and robot elements quickly. However, building a model is not so easy.
Creating the URDF model
The first step is to create an URDF model. In ROS, robots are modeled with URDF (Universal Robot Description Format). This is a an XML format to describe all elements of a robot. After reading some documents, it seems more or less easy to build a simplified robot model. However, after a few attempts, I rapidly got that it is important to take some precautions.
The URDF tree of gribot is the following:
The node chassis represents the (simplified) structure of gribot. As you ca see, there is another node called base_link. This link is necessary for simulating with Gazebo and ROS, as the simulation software do not accept a root link with inertia, etc. base_link can be considered as a projection of the robot on the ground.
I called the root node base_link as many nodes and plug-ins have it configured by default. However, I strongly recommend to configure it even if it is a default parameter: this allow to properly document your robot.
Adding simulation plugins
Now that the robot structure is ready, you need to add the different plugins used forSimulating with Gazebo and ROS. In Gribot case, they are:
- libgazebo_ros_skid_steer_drive.so: for simulating a four wheel robot
- libgazebo_ros_laser.so: for simulating the LIDAR. is you have a GPU card on you PC, you can use libgazebo_ros_gpu_laser.so.
- libgazebo_ros_joint_state_publisher.so: for publishing the state of the joints (the wheels in our case)
Create the start file
The complete start file is here. It has been split into different sub-files in order to improve readability. As you might have notices, most of the nodes are referring base_link as base_frame. This is very important, otherwise the tf tree will not be correct and you will face some strange behavior.
The tf tree of gribot is the following: