The contents of this page include:
This tutorial describes how to controll models in a Gazebo simulation using player.
For example, create a
pioneer2dx_position2d controller for any Pioneer2dx robot that you wish to move around. Note that the name of a controller indicates what type of device it attempts to simulate. However, a controller's can be assigned to any type of robot. This flexibility allows models to be quickly created in XML, and utilize prebuilt controllers.
Here we have a Pioneer2dx model with a position controller and interface:
<model:physical name="pioneer2dx_model1"> <xyz>1 0 0.25</xyz> <rpy>0.0 0.0 0.0</rpy> <python>pioneer2dx</python> <controller:pioneer2dx_position2d name="controller1"> <leftJoint>left_wheel_hinge</leftJoint> <rightJoint>right_wheel_hinge</rightJoint> <interface:position name="position_iface_1"/> </controller:pioneer2dx_position2d> <include embedded="true"> <xi:include href="pioneer2dx.model" /> </include> </model:physical>
The most important attribute to notice is the name of the interface. In this example the name is "position_iface_1". This name will be used in a Player config file to indicate what interface Player should use when access Gazebo's position device.
driver ( name "gazebo" provides ["simulation:0"] plugin "libgazeboplugin" server_id "default" ) driver ( name "gazebo" provides ["position2d:0"] gz_id "position_iface_1" )
The first driver tells Player to load the libgazeboplugin, and that it provides a simulation interface. This section should always be present in the Player config file.
The second drive tells Player that Gazebo has a Position2d interface called "position_iface_1". This name must match an interface name in the Gazebo world file.
First start the simulator:
$ gazebo worlds/pioneer2dx.world
Now start player:
$ cd gazebo/player $ player gazebo.cfg
Now test the connection using playerv:
$ playerv -h localhost
Playerv will allow you to connect to the position interface and move the robot around.
gazebo/player contains an example Player configuration file called
gazebo.cfg that provides examples to many of the playe devices.
gazebo/worlds contains numberous example worlds which can be used with the
gazebo/plaer/gazebo.cfg Player configuration file.