Note: This tutorial works on ROS Electric but has known issues in ROS Fuerte and ROS Groovy.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Introduction to Stage Controllers

Description: Stage (ver 3.0.0 and above) is equipped to work as standalone, wherein controllers integrated into stage enables motion, behaviour and processes for the robot(s). This tutorial discusses two such stage controllers.

Keywords: Stage

Tutorial Level: INTERMEDIATE

Next Tutorial: Making Maps Using Stage's Wander Controller

Why Stage Controllers ?

Those of us who have used Stage (or Player/Stage) would have probably used Stage to set up the environment and the robot and then to implement behaviour used a C++ or Python code or another ROS node. However, from Stage ver 3.0.0 onwards there is a facility of Stage Controllers; which enables some very basic behaviour inbuilt into Stage. Thus, without using any other code script or ROS node it is possible to implement behaviour in the robot.

The primary motivation for such was to develop Stage as a swarm robotics simulator - implement same behaviour to a large number of robots all at the same time.

Codes

Download the codes from https://code.google.com/archive/p/mobotica/downloads and extract the stage_controllers file and make sure that it is in the ROS path.

Build the package;

rosmake stage_controllers

Check if the package can be found by rospack;

rospack find stage_controllers

Wander Controller

Wander Controller is a basic stage controller where the robot moves around wandering and avoiding obstacles. Start an instance of the master and run this controller for the roomba robot;

rosrun stage stageros `rospack find stage_controllers`/world/roomba-wander.world

The following screen should pop up with the roomba robot wandering around.

alt text/

What is worth an appreciation is that robot's movement and obstacle avoidance is obtained from a world file and no other process had to be run in tandem.

Discussing the roomba-wander.world file :

The wander controller is made to work by the part of code at very end of the file roomba-wander.world, ctrl "wander" invokes this controller;

roomba
(                 
  # can refer to the robot by this name
  name "roomba"
  pose [ -8 6 0 0 ] 

  sicklaser()
 
  ctrl "wander"
)

Laser Noise Controller

Laser Noise Controller works in tandem with the Wander Controller and generates laser noise. Start an instance of the master and run this controller for the roomba robot;

rosrun stage stageros `rospack find stage_controllers`/world/roomba-lasernoise.world

The following screen should pop up.

alt text/

Discussing the roomba-lasernoise.world file :

In the corresponding world file, roomba-lasernoise.world the Laser Noise Controller is invoked by ctrl "lasernoise" this is made to works in tandem with the Wander Controller;

roomba
(                 
  # can refer to the robot by this name
  name "roomba"
  pose [ 2 2 0 135 ] 

  sicklaser(ctrl "lasernoise")
 
  ctrl "wander"
)

Other Such Stage Controllers

Stage has other such controllers; some deal with multirobot tasks, swarm robotics etc. Later tutorials may discuss these controllers and also about writing custom stage controllers.

Also, similar approach is possible in gazebo using the libgazebo client library to develop controllers.

References

Richard T. Vaughan. Massively Multi-Robot Simulations in Stage. Swarm Intelligence, 2(2-4):189-208, 2008

Wiki: stage/Tutorials/IntroductiontoStageControllers (last edited 2017-02-02 01:13:34 by CalebKirksey)