constraintplanning Module
Shows how to use simple gradient-based jacobians to constrain the motion of the robot while planning.
Running the Example:
openrave.py --example constraintplanning
Description
A good introduction to these methods can be found in .
A GripperJacobianConstrains class is defined in the rmanipulation plugin. It holds a RetractionConstraint function that takes in a robot configuration, and constrains the manipulator to lie in a certain manifold specified by a target frame and the degrees of freedom to constraint (translation and rotation about axes). If the projection succeeded, it returns true along with the new configuration. Such functions can be set to any planner at any time by filling the PlannerBase::PlannerParameters::_constraintfn field. In the example above, the constraint function is set inside basemanipulation.h in the following way:
PlannerBase::PlannerParametersPtr params(new PlannerBase::PlannerParameters());
// ...
// other params initialization like distance metrics (_distmetricfn)
// ...
// constrained params initialization
Transform tConstraintTargetWorldFrame; // target frame in world coordinates
RobotBase::ManipulatorPtr manip = robot->GetActiveManipulator(); // manipulator
boost::array<double,6> vconstraintfreedoms = {{1,1,0,0,0,0}}; // rotx, roty, rotz, transx, transy, transz
double constrainterrorthresh = 0.02; // threshold
// create the class
boost::shared_ptr<CM::GripperJacobianConstrains<double> > pconstraints(new CM::GripperJacobianConstrains<double>(manip,tConstraintTargetWorldFrame,vconstraintfreedoms,constrainterrorthresh));
// set the distance metric used from the one already defined in params
pconstraints->_distmetricfn = params->_distmetricfn;
// set the constraint function
params->_constraintfn = boost::bind(&CM::GripperJacobianConstrains<double>::RetractionConstraint,pconstraints,_1,_2,_3);
Command-line
Usage: openrave.py [options]
RRT motion planning with constraints on the robot end effector.
Options:
-h, --help show this help message and exit
--scene=SCENE Scene file to load (default=data/lab1.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)
robot = env.GetRobots()[0]
env.UpdatePublishedBodies()
time.sleep(0.1) # give time for environment to update
self = ConstraintPlanning(robot)
self.graspAndMove()
Class Definitions
-
class openravepy.examples.constraintplanning.ConstraintPlanning(robot, randomize=False, dests=None, switchpatterns=None, plannername=None)[ソース]
-
graspAndMove(showgoalcup=True)[ソース]
-
openravepy.examples.constraintplanning.main(env, options)[ソース]
Main example code.
-
openravepy.examples.constraintplanning.run(*args, **kwargs)[ソース]
Command-line execution of the example.
パラメタ: | args – arguments for script to parse, if not specified will use sys.argv |