libstageplugin - simulation driver for Player

libstageplugin is a plugin for Player that allows Player clients to access simulated robots as if they were normal Player devices.

Stage robots and sensors work like any other Player device: users write robot controllers and sensor algorithms as `clients' to the Player `server'. Typically, clients cannot tell the difference between the real robot devices and their simulated Stage equivalents (unless they try very hard). We have found that robot controllers developed as Player clients controlling Stage robots will work with little or no modification with the real robots and vice versa [1]. With a little care, the same binary program can often control Stage robots and real robots without even being recompiled [2]. Thus the Player/Stage system allows rapid prototyping of controllers destined for real robots. Stage can also be very useful by simulating populations of realistic robot devices you don't happen to own [3].

Authors

Richard Vaughan

[refs]

Configuration file examples:

Creating two models in a Stage worldfile, saved as "example.world":

# this is a comment
# create a position model - it can drive around like a robot
position
(
  name "marvin"
  color "red"

  pose [ 1 1 0 ]

  # add a range scanner on top of the robot
  ranger()
)

# create a position model with a gripper attached to each side
position
(
  name "gort"
  color "silver"
  pose [ 6 1 0 ]
  size [ 1 2 ]

  gripper( pose [0  1  90] )
  gripper( pose [0 -1 -90] )
)

Attaching Player interfaces to the Stage models "marvin" and "gort" in a Player config (.cfg) file:

# Present a simulation interface on the default port (6665).
# Load the Stage plugin driver and create the world described
# in the worldfile "example.world"
# The simulation interface MUST be created before any simulated devices
# models can be used.
driver
(
  name "stage"
  provides ["simulation:0"]
  plugin "libstageplugin"
  worldfile "example.world"
)

# Present a position interface on the default port (6665), connected
# to the Stage position model "marvin", and a ranger interface connected to
# the ranger child of "marvin".
driver
(
  name "stage"
  provides ["position2d:0" "ranger:0"]
  model "marvin"
)

# Present three interfaces on port 6666, connected to the Stage
# position model "gort" and its two grippers.
driver
(
  name "stage"
  provides ["6666:position2d:0" "6666:gripper:0" "6666:gripper:1"]
  model "gort"
)

More examples can be found in the Stage source tree, in directory <stage-version>/worlds.

Player configuration file options
Provides

The stage plugin driver provides the following device interfaces:

ActArray interface
  • PLAYER_ACTARRAY_REQ_GET_GEOM
  • PLAYER_ACTARRAY_CMD_POS
  • PLAYER_ACTARRAY_CMD_SPEED
  • PLAYER_ACTARRAY_DATA_STATE
Blobfinder interface
  • PLAYER_BLOBFINDER_DATA_BLOBS
Fiducial interface
  • PLAYER_FIDUCIAL_DATA_SCAN
  • PLAYER_FIDUCIAL_REQ_GET_GEOM
  • PLAYER_FIDUCIAL_REQ_SET_ID
  • PLAYER_FIDUCIAL_REQ_GET_ID
Graphics2D interface
  • PLAYER_GRAPHICS2D_CMD_POINTS
  • PLAYER_GRAPHICS2D_CMD_POLYGON
  • PLAYER_GRAPHICS2D_CMD_MULTILINE
  • PLAYER_GRAPHICS2D_CMD_POLYLINE
  • PLAYER_GRAPHICS2D_CMD_CLEAR
Graphics3D interface
  • PLAYER_GRAPHICS3D_CMD_DRAW
  • PLAYER_GRAPHICS3D_CMD_PUSH
  • PLAYER_GRAPHICS3D_CMD_POP
  • PLAYER_GRAPHICS3D_CMD_CLEAR
  • PLAYER_GRAPHICS3D_CMD_TRANSLATE
  • PLAYER_GRAPHICS3D_CMD_ROTATE
Gripper interface
  • PLAYER_GRIPPER_DATA_STATE
  • PLAYER_GRIPPER_CMD_STATE
  • PLAYER_GRIPPER_REQ_GET_GEOM
Position interface
  • PLAYER_POSITION2D_CMD_POS
  • PLAYER_POSITION2D_CMD_VEL
  • PLAYER_POSITION2D_CMD_CAR
  • PLAYER_POSITION2D_DATA_STATE
  • PLAYER_POSITION2D_REQ_GET_GEOM
  • PLAYER_POSITION2D_REQ_MOTOR_POWER
  • PLAYER_POSITION2D_REQ_RESET_ODOM
  • PLAYER_POSITION2D_REQ_SET_ODOM
  • PLAYER_POSITION2D_REQ_POSITION_MODE
Ranger interface
  • PLAYER_RANGER_DATA_RANGE
  • PLAYER_RANGER_DATA_INTENS
  • PLAYER_RANGER_REQ_GET_CONFIG
  • PLAYER_RANGER_REQ_GET_GEOM
Simulation interface
  • PLAYER_SIMULATION_REQ_GET_POSE2D player_simulation_pose2d_req_t
  • PLAYER_SIMULATION_REQ_SET_POSE2D player_simulation_pose2d_req_t
  • PLAYER_SIMULATION_REQ_GET_POSE3D player_simulation_pose3d_req_t
  • PLAYER_SIMULATION_REQ_SET_POSE3D player_simulation_pose3d_req_t
  • PLAYER_SIMULATION_REQ_SET_PROPERTY player_simulation_property_req_t
    • (name) (prop) (value) (description)
    • model "color" float[4] [0]=R, [1]=G, [2]=B, [3]=A
  • PLAYER_SIMULATION_REQ_GET_PROPERTY player_simulation_property_req_t
    • (name) (prop) (value) (description)
    • model "color" float[4] [0]=R, [1]=G, [2]=B, [3]=A
    • <unused> "time" uint64_t simulation time in usec
Speech interface
  • PLAYER_SPEECH_CMD_SAY