Examples with Stage

From MCS Wiki
Jump to: navigation, search

First step, download player, run the make file, install player. Second step, download stage, run the make file, install stage.

Stage basically acts as a stand in for ac actual robot (just like when we move to the actual robot, there will be a player driver that abstracts an actual robot to be controlled by the code). Stage "fools" player into thinking that an actual robot is living in a 2-D environment.

Using Player with Stage requires two configuration files: a Stage .world file and a Player .cfg file. The .world file defines the simulated world, telling Stage what kind of sensors and actuators are to be simulated, which background image to load, etc. The .cfg file then maps these simulated devices onto Player devices.

Stage comes with a number of example .world and .cfg files. They are installed (by default) in /usr/local/share/stage/worlds

Example 1: Pioneer Robot with Laser Range Finder in "Cave"

Associated Stage Files:

* simple.cfg [1]
* simple.world [2]
* cave.png [3]
* map.inc [4]
* pioneer.inc [5]
* sick.inc [6]

What to run: $ player /path/to/directory/with/simple.cfg

Associated Robot Control Code:

* laserobstacleavoid.cc [7]
* randomwalk.cc [8]
* args.h [9]

How to compile: $ g++ -o laserobstacleavoid `pkg-config --cflags playerc++` laserobstacleavoid.cc `pkg-config --libs playerc++`

Procedure: Run an instance of stage, which listens for instructions. Then, run the laserobstacleavoid program.

Example 2a: Create Robot in "Cave"

Associated Stage Files:

* roombacave.cfg [10]
* roombacave.world [11]
* cave.png [12]
* map.inc [13]
* roomba.inc [14]

Associated Robot Control Code:

* example.cc [15]
* args.h [16]


Example 2b: Create Robot in "Hospital Floor Plan"

Associated Stage Files:

* roombahospital.cfg [17]
* roombahospital.world [18]
* hospital_section.png [19]
* map.inc [20]
* roomba.inc [21]

Associated Robot Control Code:

* example.cc [22]
* args.h [23]
Personal tools