Every robotics application follows a continuous cycle of development. This cycle has three basic components. The first one involves the development of features; the second one relates to the testing of these features, and the last one has to do with the deployment of the updates on the robots out in the real world.
It’s important to always test any changes before deploying to working robots as the chances are that, sooner or later, things will break with devastating results to the robots and their surroundings. Testing is still done in the real world, but in a controlled environment which accommodates for safety concerns and eliminates some of the unknowns. We can take one extra step though and test the robots in a simulated world, before moving to the real one. Simulation offers several benefits. It bears no risk to robots or humans, it minimizes cost, and it allows to fail often and fast. By catching big mistakes early, we can go through iterations more quickly and get the robots stable faster. The virtual world though, more often than not, will not be a truly faithful representation of reality. So once we get the green light in simulation, we need to validate operation on real robots. As soon as we are confident about our latest release, we can deploy the updates out in the real world and let the world enjoy our newest bugs… I mean features.
ROS is the catalyst that has been facilitating the development of robots. But simulation has its super-tool too, and that is Gazebo. Gazebo is a robot simulator with a physics engine, 3D graphics, and full integration with ROS. What does each of these mean?
- With physics simulation, we can test dynamic interactions between different bodies. It’s in essence what simulation is all about. We want to model a physical system and then evaluate its performance as it interacts with its environment.
- And why would graphics be relevant in this context? Well, robots can have eyes too. As we move away from dumb fixed robots on factory floors towards mobile robots in unknown and dynamic environments, they have to be able to perceive the world around them. One way of doing so is through cameras. For that, we need proper lighting, shadows, and textures that will render a realistic scene which the robots will then try to understand.
- What do we know from ROS? We know packages, messages, services, and dynamic parameters. Gazebo’s ROS integration makes use of all these to allow starting gazebo, spawning robot models, controlling the simulation and manipulating the world. We don’t need to make any extra effort to set up a simulation. Everything is supported through familiar ROS tools and concepts.
And now you can also do everything mentioned above (development, testing, deployment) on the cloud with AWS RoboMaker. RoboMaker allows you to perform scalable and parallel simulations based on Gazebo. And it’s straightforward too. You upload your bundle on an Amazon S3 bucket, configure the simulation, have it run, and finally get your output from a folder in an S3 bucket too.
Let’s take on the task of setting up a simulation for a mobile robot such that it’s able to navigate the world while avoiding static and dynamic obstacles in its way. What are the steps for having the robot do this?
- Create the world in which the robot will live.
- Generate a map of the world that the robot will use for navigation.
- Make the robot stay localized in the world as it moves.
- Make the robot aware of its surroundings.
- Make the robot compute and follow trajectories that are always up to date with what the robot sees.
In a series of posts that will follow in the coming weeks, we will go through every step of this process with a focus on getting ourselves familiar with Gazego. For now, let’s get Gazebo ready.
We’ll be working with ROS Kinetic. If you have installed
ros-kinetic-desktop-full, Gazebo should already be in your system. Otherwise, to install Gazebo 7 (the official version under ROS Kinetic), execute the following:
If later down the line you encounter any problem with Gazebo that is said to be resolved with a newer version, you can try installing the latest Gazebo 7 version:
Now we can launch Gazebo with the following command.
This will start the gazebo server which simulates the world, and the gazebo client which is the graphical user interface which visualizes the world and allows us to manipulate the simulation. Alternatively, we can control the simulation programmatically through the ROS interface of the gazebo server.
There are a ton of information and tutorials on Gazebo and how to create a robot model for Gazebo. But when you are getting started, you don’t really want to read endless pages of instructions as this can take forever. If on the other hand, you try to work by example, you’ll find out there are packages that are not always up to date and do things in a slightly different way, which results in you being confused and overwhelmed. Instead, here I’ll try to point out the things I wish I knew when I was getting started, hoping to save you from all the initial frustration.
So this is how I choose to close 2k18… aiming for an adventure through the world of Gazebo, and I’m inviting you to come along for the ride.
See you in the next post where we will see how to create and set up a world for Gazebo.