Gazebo:Tutorials:pioneer2dx moving

From The Player Project

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://uwujojedeh.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
 +
----
 +
=[http://uwujojedeh.co.cc CLICK HERE]=
 +
----
 +
</div>
== Overview ==
== Overview ==
Line 10: Line 18:
First go to the location of all the default world files.
First go to the location of all the default world files.
-
  <code>
+
  &lt;code&gt;
  $ cd ~/local/share/gazebo/worlds
  $ cd ~/local/share/gazebo/worlds
-
  </code>
+
  &lt;/code&gt;
Now run gazebo with the pioneer2dx.world file
Now run gazebo with the pioneer2dx.world file
-
  <code>
+
  &lt;code&gt;
  $ gazebo pioneer2dx.world
  $ gazebo pioneer2dx.world
-
  </code>
+
  &lt;/code&gt;
At this point, a new window should appear that contains a Pioneer2dx sitting on a flat surface.
At this point, a new window should appear that contains a Pioneer2dx sitting on a flat surface.
Line 25: Line 33:
In a new terminal:
In a new terminal:
-
  <code>
+
  &lt;code&gt;
  $ cd ~/local/share/gazebo/player_cfgs
  $ cd ~/local/share/gazebo/player_cfgs
-
  </code>
+
  &lt;/code&gt;
Run player:
Run player:
-
  <code>
+
  &lt;code&gt;
  $ player gazebo.cfg
  $ player gazebo.cfg
-
  </code>
+
  &lt;/code&gt;
Not too much will happen here. Player should output something along the lines of:
Not too much will happen here. Player should output something along the lines of:
-
  <code>
+
  &lt;code&gt;
  Gazebo Plugin driver creating 1 device
  Gazebo Plugin driver creating 1 device
   6665.31.0 is  a simulation interface.
   6665.31.0 is  a simulation interface.
Line 44: Line 52:
  listening on 6665
  listening on 6665
  Listening on ports: 6665  
  Listening on ports: 6665  
-
  </code>
+
  &lt;/code&gt;
== Controlling the Robot ==
== Controlling the Robot ==
Line 50: Line 58:
In a new terminal:
In a new terminal:
-
  <code>
+
  &lt;code&gt;
  $ playerv -h localhost
  $ playerv -h localhost
-
  </code>
+
  &lt;/code&gt;
A window will pop-up that should a few menu items and a grid.
A window will pop-up that should a few menu items and a grid.
Line 70: Line 78:
Gazebo uses a shared memory interface to communicate with the other programs. The shared memory files are created once Gazebo is started, and are found in:
Gazebo uses a shared memory interface to communicate with the other programs. The shared memory files are created once Gazebo is started, and are found in:
-
  <code>
+
  &lt;code&gt;
-
  /tmp/gazebo-<user_name>-0/
+
  /tmp/gazebo-&lt;user_name&gt;-0/
-
  </code>
+
  &lt;/code&gt;
List the contents of that directory, and you'll see all the interfaces to entities in Gazebo. Note the Position2d and Laser interfaces.  
List the contents of that directory, and you'll see all the interfaces to entities in Gazebo. Note the Position2d and Laser interfaces.  
-
  <code>
+
  &lt;code&gt;
-
  $ ls /tmp/gazebo-<user_name>-0/
+
  $ ls /tmp/gazebo-&lt;user_name&gt;-0/
  ...
  ...
  position.pioneer2dx_model1::position_iface_0
  position.pioneer2dx_model1::position_iface_0
  laser.pioneer2dx_model1::laser_iface_0
  laser.pioneer2dx_model1::laser_iface_0
  ...
  ...
-
  </code>
+
  &lt;/code&gt;
-
Here is how the filenames break down: <interface_type>.<gazebo_model>.<interface_name>. For the position2d interface, the type is '''position''', the model which contains the interface (or your can think of this as the model that is controlled by the interface) is the '''pioneer2dx_model1''', and the name of the interface itself is '''position_iface_0'''.
+
Here is how the filenames break down: &lt;interface_type&gt;.&lt;gazebo_model&gt;.&lt;interface_name&gt;. For the position2d interface, the type is '''position''', the model which contains the interface (or your can think of this as the model that is controlled by the interface) is the '''pioneer2dx_model1''', and the name of the interface itself is '''position_iface_0'''.
This information is used in the Player configuration file. Take a look at the gazebo.cfg file used previously in this tutorial. Look at this section:
This information is used in the Player configuration file. Take a look at the gazebo.cfg file used previously in this tutorial. Look at this section:
-
  <code>
+
  &lt;code&gt;
  driver
  driver
  (
  (
-
   name "gazebo"
+
   name &quot;gazebo&quot;
-
   provides ["position2d:0"]
+
   provides [&quot;position2d:0&quot;]
-
   gz_id "pioneer2dx_model1::position_iface_0"
+
   gz_id &quot;pioneer2dx_model1::position_iface_0&quot;
  )
  )
-
  </code>
+
  &lt;/code&gt;
The '''provides''' tag tells this driver what type of interface this driver uses, and the gz_id tells the driver where to find the matching Gazebo interface. This name must match a name in the Gazebo shared memory interfaces.
The '''provides''' tag tells this driver what type of interface this driver uses, and the gz_id tells the driver where to find the matching Gazebo interface. This name must match a name in the Gazebo shared memory interfaces.

Revision as of 04:39, 24 November 2010



Contents

Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly


CLICK HERE


Overview

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.

Launching Gazebo

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.

<code>
$ cd ~/local/share/gazebo/worlds
</code>

Now run gazebo with the pioneer2dx.world file

<code>
$ gazebo pioneer2dx.world
</code>

At this point, a new window should appear that contains a Pioneer2dx sitting on a flat surface.

Launching Player

Once Gazebo is up and running, you can also run Player to control robots inside Gazebo.

In a new terminal:

<code>
$ cd ~/local/share/gazebo/player_cfgs
</code>

Run player:

<code>
$ player gazebo.cfg
</code>

Not too much will happen here. Player should output something along the lines of:

<code>
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 
</code>

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:

<code>
$ playerv -h localhost
</code>

A window will pop-up that should a few menu items and a grid.

  1. Select the Devices menu item, then Position2d:0, then Subscribe.
  2. Select the Devices menu item, then Position2d:0, then Enable.
  3. 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:

  1. Select the Devices menu item, then Laser:0, then Subscribe.

Behind the Scenes

Here is a little insight into what's going on.

Gazebo uses a shared memory interface to communicate with the other programs. The shared memory files are created once Gazebo is started, and are found in:

<code>
/tmp/gazebo-<user_name>-0/
</code>

List the contents of that directory, and you'll see all the interfaces to entities in Gazebo. Note the Position2d and Laser interfaces.

<code>
$ ls /tmp/gazebo-<user_name>-0/
...
position.pioneer2dx_model1::position_iface_0
laser.pioneer2dx_model1::laser_iface_0
...
</code>

Here is how the filenames break down: <interface_type>.<gazebo_model>.<interface_name>. For the position2d interface, the type is position, the model which contains the interface (or your can think of this as the model that is controlled by the interface) is the pioneer2dx_model1, and the name of the interface itself is position_iface_0.

This information is used in the Player configuration file. Take a look at the gazebo.cfg file used previously in this tutorial. Look at this section:

<code>
driver
(
 name "gazebo"
 provides ["position2d:0"]
 gz_id "pioneer2dx_model1::position_iface_0"
)
</code>

The provides tag tells this driver what type of interface this driver uses, and the gz_id tells the driver where to find the matching Gazebo interface. This name must match a name in the Gazebo shared memory interfaces.

Personal tools