testphysics_controller Module
Shows velocity control with ode controller.
Running the Example:
openrave.py --example testphysics_controller
Command-line
Usage: openrave.py [options]
test physics
Options:
-h, --help show this help message and exit
--scene=SCENE Scene file to load (default=data/hanoi.env.xml)
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)
if options._physics is None:
# no physics engine set, so set one
physics = RaveCreatePhysicsEngine(env,'ode')
env.SetPhysicsEngine(physics)
physics.SetGravity(array((0,0,-9.8)))
with env:
robot = env.GetRobots()[0]
robot.GetLinks()[0].SetStatic(True)
robot.SetController(RaveCreateController(env,'odevelocity'),range(robot.GetDOF()),0)
env.StopSimulation()
env.StartSimulation(timestep=0.001)
starttime = time.time()
while True:
velocities = 0.5*(random.rand(robot.GetDOF())-0.5)
robot.GetController().SendCommand('setvelocity '+' '.join(str(f) for f in velocities))
time.sleep(2.0)
Class Definitions
-
openravepy.examples.testphysics_controller.main(env, options)[ソース]
Main example code.
-
openravepy.examples.testphysics_controller.run(*args, **kwargs)[ソース]
Command-line execution of the example.
パラメタ: | args – arguments for script to parse, if not specified will use sys.argv |