Usage: openrave.py --example simplemanipulation [options]
Explicitly specify goals to get a simple navigation and manipulation demo.
Options:
-h, --help show this help message and exit
--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

defmain(env,options):"Main example code."# load a scene from ProjectRoom environment XML fileenv.Load('data/pr2test2.env.xml')time.sleep(1)# 1) get the 1st robot that is inside the loaded scene# 2) assign it to the variable named 'robot'robot=env.GetRobots()[0]manip=robot.SetActiveManipulator('leftarm_torso')# set the manipulator to leftarm + torsoikmodel=databases.inversekinematics.InverseKinematicsModel(robot,iktype=IkParameterization.Type.Transform6D)ifnotikmodel.load():ikmodel.autogenerate()# create the interface for basic manipulation programsbasemanip=interfaces.BaseManipulation(robot,plannername=options.planner)taskprob=interfaces.TaskManipulation(robot,plannername=options.planner)target=env.GetKinBody('TibitsBox1')withenv:jointnames=['l_shoulder_lift_joint','l_elbow_flex_joint','l_wrist_flex_joint','r_shoulder_lift_joint','r_elbow_flex_joint','r_wrist_flex_joint']robot.SetActiveDOFs([robot.GetJoint(name).GetDOFIndex()fornameinjointnames])basemanip.MoveActiveJoints(goal=[1.29023451,-2.32099996,-0.69800004,1.27843491,-2.32100002,-0.69799996])waitrobot(robot)print'move robot base to target'withenv:robot.SetActiveDOFs([],DOFAffine.X|DOFAffine.Y|DOFAffine.RotationAxis,[0,0,1])basemanip.MoveActiveJoints(goal=[2.8,-1.3,0],maxiter=5000,steplength=0.15,maxtries=2)waitrobot(robot)taskprob.ReleaseFingers()waitrobot(robot)print'move the arm to the target'Tgoal=array([[0,-1,0,3.5],[-1,0,0,-1.3],[0,0,-1,0.842],[0,0,0,1]])res=basemanip.MoveToHandPosition(matrices=[Tgoal],seedik=16)waitrobot(robot)print'close fingers until collision'taskprob.CloseFingers()waitrobot(robot)print'move the arm with the target back to the initial position'withenv:robot.Grab(target)basemanip.MoveManipulator(goal=[0,0,1.29023451,0,-2.32099996,0,-0.69800004,0])waitrobot(robot)print'move the robot to another location'withenv:robot.SetActiveDOFs([],DOFAffine.X|DOFAffine.Y|DOFAffine.RotationAxis,[0,0,1])localgoal=[0,2.4,0]T=robot.GetTransform()goal=dot(T[0:3,0:3],localgoal)+T[0:3,3]withrobot:robot.SetActiveDOFValues(goal)incollision=env.CheckCollision(robot)ifincollision:print'goal in collision!!'basemanip.MoveActiveJoints(goal=goal,maxiter=5000,steplength=0.15,maxtries=2)waitrobot(robot)print'move the arm to the designated position on another table to place the target down'Tgoal=array([[0,-1,0,3.5],[-1,0,0,1.5],[0,0,-1,0.855],[0,0,0,1]])res=basemanip.MoveToHandPosition(matrices=[Tgoal],seedik=16)waitrobot(robot)taskprob.ReleaseFingers(target=target)waitrobot(robot)print'move manipulator to initial position'basemanip.MoveManipulator(goal=[0,0,1.29023451,0,-2.32099996,0,-0.69800004,0])waitrobot(robot)print'close fingers until collision'taskprob.CloseFingers()waitrobot(robot)