OpenRAVE Documentation

tutorial_ik5d Module

Shows how to use 5D translation+direction inverse kinematics for an arm with >= 5 joints.

../../_images/tutorial_ik5d.jpg

Running the Example:

openrave.py --example tutorial_ik5d

Command-line

Usage: openrave.py [options]

Shows how to use the 5DOF IK solution for arms with >= 5 joints.

Options:
  -h, --help            show this help message and exit
  --scene=SCENE         Scene file to load (default=data/katanatable.env.xml)
  --manipname=MANIPNAME
                        name of manipulator to use (default=arm)

  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)
    robot = env.GetRobots()[0]
    robot.SetActiveManipulator(options.manipname)

    # generate the ik solver
    ikmodel = databases.inversekinematics.InverseKinematicsModel(robot, iktype=IkParameterization.Type.TranslationDirection5D)
    if not ikmodel.load():
        ikmodel.autogenerate()

    while True:
        with env:
            while True:
                target=ikmodel.manip.GetTransform()[0:3,3]+(random.rand(3)-0.5)
                direction = random.rand(3)-0.5
                direction /= linalg.norm(direction)
                solutions = ikmodel.manip.FindIKSolutions(IkParameterization(Ray(target,direction),IkParameterization.Type.TranslationDirection5D),IkFilterOptions.CheckEnvCollisions)
                if solutions is not None and len(solutions) > 0: # if found, then break
                    break
        h=env.drawlinestrip(array([target,target+0.1*direction]),10)
        for i in random.permutation(len(solutions))[0:min(80,len(solutions))]:
            with env:
                robot.SetDOFValues(solutions[i],ikmodel.manip.GetArmIndices())
                env.UpdatePublishedBodies()
            time.sleep(0.2)
        h=None

Class Definitions

openravepy.examples.tutorial_ik5d.main(env, options)[source]

Main example code.

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