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.
-
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
-
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.
-
-
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.
-
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.
-
envCollision
(x=None)[source]¶ Checks whether the robot at its current configuration is in collision with the environment.
-
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.
-
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.