klampt.plan.robotcspace module¶
Classes:

A basic robot cspace that allows collision free motion. 

A closed loop cspace. 

A closed loop cspace with an arbitrary numerical manifold f(q)=0 to constrain the robot’s motion. 

A basic robot cspace that allows collision free motion of a subset of joints. 

A basic robot cspace that allows collision free motion of a subset of joints. 

class
klampt.plan.robotcspace.
RobotCSpace
(robot, collider=None)[source]¶ Bases:
klampt.plan.cspace.CSpace
A basic robot cspace that allows collision free motion.
 Parameters
robot (RobotModel) – the robot that’s moving.
collider (
WorldCollider
, optional) –a collide.WorldCollider instance instantiated with the world in which the robot lives. Any ignored collisions in the collider will be respected in the feasibility tests of this CSpace.
If this is not provided, then only selfcollisions will be checked.
Warning
If your robot has nonstandard joints, like a free floating base or continuously rotating (spin) joints, you may need to overload the
sample()
method. The default implementation assumes that everything with unbounded limits is a rotational joint.Methods:
addConstraint
(checker[, name])sample
()Overload this to implement custom sampling strategies or to handle nonstandard joints.
Checks joint limits of the configuration x
selfCollision
([x])Checks whether the robot at its current configuration is in self collision
envCollision
([x])Checks whether the robot at its current configuration is in collision with the environment.
interpolate
(a, b, u)distance
(a, b)sendPathToController
(path, controller)Given a planned CSpace path ‘path’ and a SimRobotController ‘controller’, sends the path so that it is executed correctly by the controller (this assumes a fully actuated robot).

sample
()[source]¶ Overload this to implement custom sampling strategies or to handle nonstandard joints. This one will handle spin joints and rotational axes of floating bases.

selfCollision
(x=None)[source]¶ Checks whether the robot at its current configuration is in self collision

class
klampt.plan.robotcspace.
ClosedLoopRobotCSpace
(robot, iks, collider=None)[source]¶ Bases:
klampt.plan.robotcspace.RobotCSpace
A closed loop cspace. Allows one or more IK constraints to be maintained during the robot’s motion.

maxIters
¶ the maximum number of iterations for numerical IK solver
 Type
int

tol
¶ how closely the IK constraint must be met, in meters and/ or radians
 Type
float
To satisfy the IK constraint, the motion planner ensures that configuration samples are projected to the manifold of closedloop IK solutions. To create edges between samples a and b, the straight line path a and b is projected to the manifold via an IK solve.
Methods:
setIKActiveDofs
(activeSet)Marks that only a subset of the DOFs of the robot are to be used for solving the IK constraint.
sample
()Samples directly on the contact manifold.
sampleneighborhood
(c, r)Samples a neighborhood in ambient space and then projects onto the contact manifold.
Given an initial configuration of the robot x, attempts to solve the IK constraints given in this space.
closedLoop
([config, tol])Returns true if the closed loop constraint has been met at config, or if config==None, the robot’s current configuration.
interpolate
(a, b, u)Interpolates on the manifold.
interpolationPath
(a, b[, epsilon])Creates a discretized path on the contact manifold between the points a and b, with resolution epsilon.
discretizePath
(path[, epsilon])Given a
CSpace
pathpath
, generates a path that satisfies closedloop constraints up to the given distance between milestones.sendPathToController
(path, controller[, epsilon])Given a
CSpace
pathpath
, sends the path to be executed to theSimRobotController
controller
.
setIKActiveDofs
(activeSet)[source]¶ Marks that only a subset of the DOFs of the robot are to be used for solving the IK constraint.
 Parameters
activeSet (list of int) – the robot DOF indices that should be active.

sample
()[source]¶ Samples directly on the contact manifold. The basic method samples arbitrarily in the configuration space and then solves IK constraints. This may be an ineffective method especially for floatingbase robots, since the floating joints may be sampled arbitrarily.

sampleneighborhood
(c, r)[source]¶ Samples a neighborhood in ambient space and then projects onto the contact manifold.

solveConstraints
(x)[source]¶ Given an initial configuration of the robot x, attempts to solve the IK constraints given in this space. Return value is the best configuration found via local optimization.

closedLoop
(config=None, tol=None)[source]¶ Returns true if the closed loop constraint has been met at config, or if config==None, the robot’s current configuration.

interpolationPath
(a, b, epsilon=0.01)[source]¶ Creates a discretized path on the contact manifold between the points a and b, with resolution epsilon.

discretizePath
(path, epsilon=0.01)[source]¶ Given a
CSpace
pathpath
, generates a path that satisfies closedloop constraints up to the given distance between milestones.

sendPathToController
(path, controller, epsilon=0.01)[source]¶ Given a
CSpace
pathpath
, sends the path to be executed to theSimRobotController
controller
.This discretizes the path and sends it as a piecewise linear curve, limited in speed by the robot’s maximum velocity.
Note
This isn’t the best thing to do for robots with slow acceleration limits and/or high inertias because it ignores acceleration. A better solution can be found in the MInTOS package or the C++ code in Klampt/Cpp/Planning/RobotTimeScaling.h.


class
klampt.plan.robotcspace.
ImplicitManifoldRobotCSpace
(robot, implicitConstraint, collider=None)[source]¶ Bases:
klampt.plan.robotcspace.RobotCSpace
A closed loop cspace with an arbitrary numerical manifold f(q)=0 to constrain the robot’s motion. The argument implicitConstraint should be a function f(q) returning a list of values that should be equal to 0 up to the given tolerance. Essentially this is a ClosedLoopRobotCSpace except with a userprovided function.
Methods:
sample
()Samples directly on the contact manifold
onManifold
(x[, tol])Returns true if the manifold constraint has been met at x.
solveManifold
(x[, tol, maxIters])Solves the manifold constraint starting from x, to the given tolerance and with the given maximum iteration count.
interpolate
(a, b, u)Interpolates on the manifold.

class
klampt.plan.robotcspace.
EmbeddedRobotCSpace
(ambientspace, subset, xinit=None)[source]¶ Bases:
klampt.plan.cspaceutils.EmbeddedCSpace
A basic robot cspace that allows collision free motion of a subset of joints. The subset is given by the indices in the list “subset” provided to the constructor. The configuration space is R^k where k is the number of DOFs in the subset.
 Parameters
ambientspace (RobotCSpace) – a RobotCSpace, ClosedLoopRobotCSpace, etc.
subset (list of ints) – the indices of moving DOFs
xinit (configuration, optional) – the reference configuration, or None to use the robot’s current configuration as the reference.
Methods:
This modifies the collider in ambientspace to only check collisions between moving pairs.
discretizePath
(path[, epsilon])Only useful for ClosedLoopRobotCSpace
sendPathToController
(path, controller)Sends a planned path so that it is executed correctly by the controller (assumes a fully actuated robot).

disableInactiveCollisions
()[source]¶ This modifies the collider in ambientspace to only check collisions between moving pairs. Should be called before setup() in most cases.

sendPathToController
(path, controller)[source]¶ Sends a planned path so that it is executed correctly by the controller (assumes a fully actuated robot).
 Parameters
path (list of Configs) – a path in the embedded space or the ambient space, as returned by a planner.
controller (SimRobotController) – the robot’s controller

class
klampt.plan.robotcspace.
RobotSubsetCSpace
(robot, subset, collider=None)[source]¶ Bases:
klampt.plan.cspaceutils.EmbeddedCSpace
A basic robot cspace that allows collision free motion of a subset of joints. The subset is given by the indices in the list “subset” provided to the constructor. The configuration space is R^k where k is the number of DOFs in the subset.
This class will automatically disable all collisions for inactive robot links in the collider.
Note
To convert from start/goal robot configurations to the CSpace, call the project(qrobot) method for the start and goal. (see
EmbeddedCSpace.project()
)Note
To convert from a planned path back to the robot’s full configuration space, you will need to call the lift(q) method for all configurations q in the planned path. (see
EmbeddedCSpace.lift()
)Warning
If your robot has nonstandard joints, like a freefloating base or continuously rotating (spin) joints, you will need to overload the
sample()
method.Deprecated since version 0.8.6: Deprecated this in favor of EmbeddedRobotCSpace, which is adaptable to ClosedLoopRobotCSpace and ImplicitManifoldRobotCSpace. To convert code to EmbeddedRobotCSpace, convert
space = RobotSubsetCSpace(robot,subset,collider)
tospace = EmbeddedCSpace(RobotCSpace(robot,collider),subset);
space.disableInactiveCollisions()
Methods:
sendPathToController
(path, controller)Given a planned
CSpace
pathpath
and aSimRobotController
controller
, sends the path so that it is executed correctly by the controller.