OpenRAVE Documentation

constraintplanning Module

Shows how to use simple gradient-based jacobians to constrain the motion of the robot while planning.


Running the Example: --example constraintplanning


A good introduction to these methods can be found in [1].

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);


Usage: [options]

RRT motion planning with constraints on the robot end effector.

  -h, --help            show this help message and exit
  --scene=SCENE         Scene file to load (default=data/lab1.env.xml)

  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."
    robot = env.GetRobots()[0]
    time.sleep(0.1) # give time for environment to update
    self = ConstraintPlanning(robot)

Class Definitions

[1]Mike Stilman. Task constrained motion planning in robot joint space. In: Proceedings of the IEEE International Conference on Intelligent Robots and Systems (IROS), 2007.
class openravepy.examples.constraintplanning.ConstraintPlanning(robot, randomize=False, dests=None, switchpatterns=None, plannername=None)[source]
openravepy.examples.constraintplanning.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?