OpenRAVE Documentation

testviewercallback Module

Shows how to setup a callback for mouse clicks on the viewer.

../../_images/testviewercallback.jpg

Running the Example:

openrave.py --example testviewercallback

Command-line

Usage: openrave.py [options]

Shows how to attach a callback to a viewer to perform functions.

Options:
  -h, --help            show this help message and exit
  --scene=SCENE         OpenRAVE scene to load

  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."
    env.Load(options.scene)
    handle = env.GetViewer().RegisterItemSelectionCallback(lambda link,pos,org: itemselectioncb(link,pos,org,env))
    if handle is None:
        print 'failed to register handle'
        sys.exit(1)
    while True:
        cmd = raw_input('In selection mode (ESC), click anywhere on the viewer. Enter command (q-quit): ')
        if cmd == 'q':
            break

Class Definitions

openravepy.examples.testviewercallback.itemselectioncb(link, pos, org, env)[source]
openravepy.examples.testviewercallback.main(env, options)[source]

Main example code.

openravepy.examples.testviewercallback.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?