OpenRAVE Documentation

testupdatingbodies Module

Manually call the simulation loop to update the bodies while environment is locked.

../images/examples/testupdatingbodies.jpg

Running the Example:

openrave.py --example testupdatingbodies

Command-line

Usage: openrave.py [options]

test physics

Options:
  -h, --help            show this help message and exit

  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):
    env.Load('data/lab1.env.xml')
    robot = env.GetRobots()[0]
    manipprob = interfaces.BaseManipulation(robot)
    
    Tcamera = array(((0.84028,  -0.14715,   0.52179,0.930986),
                     (0.52639,   0.45182,  -0.72026,-1.233453),
                     (-0.12976,   0.87989,   0.45711,2.412977)))
    env.GetViewer().SetCamera(Tcamera)
    env.GetViewer().EnvironmentSync()
    
    print 'Stopping the environment loop from updating the simulation'
    env.StopSimulation()
    print 'Locking environment and starting to plan'
    with env:
        res = manipprob.MoveManipulator(goal=[-0.75,1.24,-0.064,2.33,-1.16,-1.548,1.19])
        print 'Calling the simulation loop internally to python'
        while not robot.GetController().IsDone():
            env.StepSimulation(0.01)
            env.UpdatePublishedBodies() # used to publish body information while environment is locked
            time.sleep(0.1)    
    raw_input('press any key to exit: ')

Class Definitions

openravepy.examples.testupdatingbodies.main(env, options)[source]
openravepy.examples.testupdatingbodies.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?