OpenRAVE Documentation

hanoi Module

Solves the hanoi problem using simple arm planning.

../../_images/hanoi.jpg

Running the Example:

openrave.py --example hanoi

Description

This example solves the Hanoi Puzzle using the Puma arm. You can easily change the locations of the pegs, disks, or add obstacles in the environment files data/hanoi_complex.env.xml and data/hanoi.env.xml to make the problem harder. The default planner used is the rBiRRT, you can easily change it to a different planner by changing the arguments to the BaseManipulation problem.

Command-line

Usage: openrave.py --example hanoi [options]

Manipulation planning example solving the hanoi problem.

Options:
  -h, --help            show this help message and exit
  --scene=SCENE         Scene file to load
                        (default=data/hanoi_complex2.env.xml)
  --planner=PLANNER     the planner to use

  OpenRAVE Environment Options:
    --loadplugin=_LOADPLUGINS
                        List all plugins and the interfaces they provide.
    --collision=_COLLISION
                        Default collision checker to use
    --physics=_PHYSICS  physics engine to use (default=none)
    --viewer=_VIEWER    viewer to use (default=qtcoin)
    --server=_SERVER    server to use (default=None).
    --serverport=_SERVERPORT
                        port to load server on (default=4765).
    --module=_MODULES   module to load, can specify multiple modules. Two
                        arguments are required: "name" "args".
    -l _LEVEL, --level=_LEVEL, --log_level=_LEVEL
                        Debug level, one of
                        (fatal,error,warn,info,debug,verbose,verifyplans)
    --testmode          if set, will run the program in a finite amount of
                        time and spend computation time validating results.
                        Used for testing

Main Python Code

def main(env,options):
    "Main example code."
    while True:
        env.Reset()
        env.Load(options.scene)
        hanoi = HanoiPuzzle(env,env.GetRobots()[0],plannername=options.planner)
        hanoi.hanoisolve(3,hanoi.srcpeg,hanoi.destpeg,hanoi.peg)
        if options.testmode:
            break

Class Definitions

class openravepy.examples.hanoi.HanoiPuzzle(env, robot, plannername=None)[source]
GetGrasp(Tdisk, radius, angles)[source]

returns the transform of the grasp given its orientation and the location/size of the disk

MoveToPosition(values, indices)[source]

uses a planner to safely move the hand to the preshape and returns the trajectory.

move the robot out of the way so it can complete a preshape

hanoimove(disk, srcpeg, destpeg, height)[source]

Moves the arm and manipulator to grasp a peg and place it on a different peg

hanoisolve(n, pegfrom, pegto, pegby)[source]
putblock(disk, srcpeg, destpeg, height)[source]
waitrobot()[source]

busy wait for robot completion

openravepy.examples.hanoi.main(env, options)[source]

Main example code.

openravepy.examples.hanoi.run(*args, **kwargs)[source]

Command-line execution of the example.

Parameters:args – arguments for script to parse, if not specified will use sys.argv

Questions/Feedback

Having problems with OpenRAVE?