OpenRAVE Documentation

checkconvexdecomposition Module

Builds the convex decomposition of the robot and plots all points inside its volume.


Running the Example: --example checkconvexdecomposition


Uses ConvexDecompositionModel.testPointsInside() from convexdecomposition.


Usage: [options]

Builds the convex decomposition of the robot and plots all the points that are
tested inside of it.

  -h, --help            show this help message and exit
  --target=TARGET       Target body to load
                        The sampling rate for the robot (default=none)

  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."
    samplingdelta = options.samplingdelta
    body = env.GetBodies()[0]
    cdmodel = databases.convexdecomposition.ConvexDecompositionModel(body)
    if not cdmodel.load():
    ab = body.ComputeAABB()
    if samplingdelta is None:
        samplingdelta = numpy.linalg.norm(ab.extents())/30.0
    boxmin = ab.pos()-ab.extents()
    boxmax = ab.pos()+ab.extents()
    X,Y,Z = numpy.mgrid[boxmin[0]:boxmax[0]:samplingdelta,boxmin[1]:boxmax[1]:samplingdelta,boxmin[2]:boxmax[2]:samplingdelta]
    points = numpy.c_[X.flat,Y.flat,Z.flat]
    print 'computing %d points...'%len(points)
    inside = cdmodel.testPointsInside(points)
    plottedpoints = points[numpy.flatnonzero(inside),:]
    plottedpoints[:,1] += ab.extents()[1]*2
    print '%d points are inside'%len(plottedpoints)
    h = env.plot3(plottedpoints,2)
    if not options.testmode:
        raw_input('press any key to exit')

Class Definitions

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