From The Player Project
We assume that you have installed both Gazebo and Player locally (in your home directory).
This tutorial demonstrates how to move a robot around in Gazebo using a graphical tool in Player called playerv. By the end of this tutorial, you will know how to launch Gazebo, edit a player config file to correspond to a robot in Gazebo, and use the playerv tool to move the robot around.
The first step is to launch Gazebo and place a robot in the world. Gazebo takes at a minimum one command line argument, which is a word file. This file tells Gazebo how to setup the world, and what to place in it. We won't delve into the guts of the world file in this tutorial.
First go to the location of all the default world files.
$ cd ~/local/share/gazebo/worlds
Now run gazebo with the pioneer2dx.world file
$ gazebo pioneer2dx.world
At this point, a new window should appear that contains a Pioneer2dx sitting on a flat surface.
Once Gazebo is up and running, you can also run Player to control robots inside Gazebo.
In a new terminal:
$ cd ~/local/share/gazebo/player_cfgs
$ player gazebo.cfg
Not too much will happen here. Player should output something along the lines of:
Gazebo Plugin driver creating 1 device 6665.31.0 is a simulation interface. Gazebo Plugin driver creating 1 device 6665.4.0 is a position2d interface. Gazebo Plugin driver creating 1 device 6665.6.0 is a laser interface. listening on 6665 Listening on ports: 6665
Controlling the Robot
Now that the simulated robot is running in Gazebo and the Player is running, we can control the robot using a graphical interface called playerv.
In a new terminal:
$ playerv -h localhost
A window will pop-up that should a few menu items and a grid.
- Select the Devices menu item, then Position2d:0, then Subscribe.
- Select the Devices menu item, then Position2d:0, then Enable.
- Select the Devices menu item, then Position2d:0, then Command.
At this point a red box and cross-hair should be visible in playerv. Left-click on the cross hair and drag it around. Once you do this, the robot in Gazebo should move.
If you want to see the output from the laser:
- Select the Devices menu item, then Laser:0, then Subscribe.