klampt.plan.robotcspace module

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.

solver

the solver containing all IK constraints

Type:IKSolver
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 closed-loop 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.

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.

discretizePath(path, epsilon=0.01)[source]

Given a CSpace path path, generates a path that satisfies closed-loop constraints up to the given distance between milestones

interpolate(a, b, u)[source]

Interpolates on the manifold. Used by edge collision checking

interpolationPath(a, b, epsilon=0.01)[source]

Creates a discretized path on the contact manifold between the points a and b, with resolution epsilon

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 floating-base 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

sendPathToController(path, controller, epsilon=0.01)[source]

Given a CSpace path path, sends the path to be executed to the SimRobotController. 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/Planning/RobotTimeScaling.h.

setIKActiveDofs(activeSet)[source]

Marks that only a subset of the DOFs of the robot are to be used for solving the IK constraint.

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.

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 user-provided function.

See ClosedLoopRobotCSpace.

interpolate(a, b, u)[source]

Interpolates on the manifold. Used by edge collision checking

onManifold(x, tol=None)[source]

Returns true if the manifold constraint has been met at x.

sample()[source]

Samples directly on the contact manifold

solveManifold(x, tol=None, maxIters=None)[source]

Solves the manifold constraint starting from x, to the given tolerance and with the given maximum iteration count. Default uses the values set as attributes of this class.

class klampt.plan.robotcspace.RobotCSpace(robot, collider=None)[source]

Bases: klampt.plan.cspace.CSpace

A basic robot cspace that allows collision free motion.

Warning: if your robot has non-standard joints, like a free- floating base or continuously rotating (spin) joints, you will need to overload the sample() method.

Parameters:
  • robot (RobotModel) – the robot which should move.
  • 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.
addConstraint(checker, name=None)[source]
distance(a, b)[source]
envCollision(x=None)[source]

Checks whether the robot at its current configuration is in collision with the environment.

inJointLimits(x)[source]

Checks joint limits of the configuration x

interpolate(a, b, u)[source]
sample()[source]

Overload this to implement custom sampling strategies or to handle non-standard 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

sendPathToController(path, controller)[source]

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

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 non-standard joints, like a free- floating base or continuously rotating (spin) joints, you will need to overload the sample() () method.

sendPathToController(path, controller)[source]

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