checkconvexdecomposition Module
Builds the convex decomposition of the robot and plots all points inside its volume.
Running the Example:
openrave.py --example checkconvexdecomposition
Description
Uses ConvexDecompositionModel.testPointsInside() from convexdecomposition.
Command-line
Usage: openrave.py [options]
Builds the convex decomposition of the robot and plots all the points that are
tested inside of it.
Options:
-h, --help show this help message and exit
--target=TARGET Target body to load
(default=robots/barrettwam.robot.xml)
--samplingdelta=SAMPLINGDELTA
The sampling rate for the robot (default=none)
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."
samplingdelta = options.samplingdelta
env.Load(options.target)
body = env.GetBodies()[0]
cdmodel = databases.convexdecomposition.ConvexDecompositionModel(body)
if not cdmodel.load():
cdmodel.autogenerate()
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.
-
openravepy.examples.checkconvexdecomposition.run(*args, **kwargs)[source]
Command-line execution of the example.
Parameters: | args – arguments for script to parse, if not specified will use sys.argv |