OpenRAVE Documentation

testviewercallback Module

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


Running the Example: --example testviewercallback


Usage: [options]

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

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

  OpenRAVE Environment Options:
                        List all plugins and the interfaces they provide.
                        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).
                        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
    --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."
    handle = env.GetViewer().RegisterItemSelectionCallback(lambda link,pos,org: itemselectioncb(link,pos,org,env))
    if handle is None:
        print 'failed to register handle'
    while True:
        cmd = raw_input('In selection mode (ESC), click anywhere on the viewer. Enter command (q-quit): ')
        if cmd == 'q':

Class Definitions

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

Main example code.*args, **kwargs)[source]

Command-line execution of the example.

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


Having problems with OpenRAVE?