klampt.plan.cspaceutils module¶
General utilities for creating and operating with C-spaces.
Classes:
|
A cartesian product of multiple spaces, given as a list upon construction. |
|
A subspace of an ambient space, with the active DOFs given by a list of DOF indices of that ambient space. |
|
An adaptor that “lifts” a motion planner in an EmbeddedCSpace to a higher dimensional ambient space. |
Functions:
|
|
|
|
|
|
|
Helper: makes a space’s callbacks perform the default Cartesian space operations. |
-
class
klampt.plan.cspaceutils.
CompositeCSpace
(spaces)[source]¶ Bases:
klampt.plan.cspace.CSpace
A cartesian product of multiple spaces, given as a list upon construction. The feasible method can be overloaded to include interaction tests.
Methods:
feasible
(x)Overload this to define your new feasibility test.
join
(xs)sample
()Overload this to define a nonuniform sampler.
split
(x)subDims
()-
feasible
(x)[source]¶ Overload this to define your new feasibility test. By default the implementation simply tests the bounds constraint, or if self.feasibilityTests is not empty, tests each function in self.feasibilityTests.
-
-
class
klampt.plan.cspaceutils.
EmbeddedCSpace
(ambientspace, subset, xinit=None)[source]¶ Bases:
klampt.plan.cspace.CSpace
A subspace of an ambient space, with the active DOFs given by a list of DOF indices of that ambient space.
Note
A MotionPlan constructed on this object operates in the embedded space, NOT the ambient space. To push endpoints to the embedded space you will need to call
EmbeddedCSpace.project()
, and to pull a plan back to the ambient space, use theEmbeddedCSpace.liftPlan()
method.To make this more convenient, the SubsetMotionPlan class is provided for you.
Note
Sampling does not work directly when the ambient space has implicit manifold constraints, e.g., closed-loop constraints. sample and sampleneighborhood will need to be customized so that the constraint solving is done without perturbing the seed configuration except for the dofs in the moving subset.
-
mapping
¶ the list of active indices into the ambient configuration space
- Type
list
-
xinit
¶ the initial configuration in the ambient space (by default, 0 vector)
- Type
list, optional
Methods:
feasible
(x)Overload this to define your new feasibility test.
lift
(xemb)Embedded space -> ambient space
liftPath
(path)Given a CSpace path, lifts it to a full ambient C-space path
project
(xamb)Ambient space -> embedded space
projectPath
(path_amb)Given an ambient C-space path, projects it to a C-space path
sample
()Overload this to define a nonuniform sampler.
-
-
class
klampt.plan.cspaceutils.
SubsetMotionPlan
(space, subset, q0, type=None, **options)[source]¶ Bases:
klampt.plan.cspace.MotionPlan
An adaptor that “lifts” a motion planner in an EmbeddedCSpace to a higher dimensional ambient space. Used for planning in subsets of robot DOFs.
Initializes a plan with a given CSpace and a given type. Optionally, planner options can be set via keyword arguments.
Valid values for type are:
‘prm’: the Probabilistic Roadmap algorithm
‘rrt’: the Rapidly Exploring Random Trees algorithm
‘sbl’: the Single-Query Bidirectional Lazy planner
‘sblprt’: the probabilistic roadmap of trees (PRT) algorithm with SBL as the inter-root planner.
‘rrt*’: the RRT* algorithm for optimal motion planning
‘prm*’: the PRM* algorithm for optimal motion planning
‘lazyprm*’: the Lazy-PRM* algorithm for optimal motion planning
‘lazyrrg*’: the Lazy-RRG* algorithm for optimal motion planning
‘fmm’: the fast marching method algorithm for resolution-complete optimal motion planning
‘fmm*’: an anytime fast marching method algorithm for optimal motion planning
(this list may be out-of-date; the most current documentation is listed in src/motionplanning.h)
Methods:
addMilestone
(x)Manually adds a milestone from the ambient space, and returns its index
getPath
([milestone1, milestone2])Lifts the motion planner’s lower-dimensional path back to the ambient space
Lifts the motion planner’s lower-dimensional roadmap back to the ambient space
lift
(xemb)Embedded space -> ambient space
project
(xamb)Ambient space -> embedded space
setEndpoints
(start, goal)Takes care of projecting the start and goal (represented in the ambient space) down to the subset.
-
getPath
(milestone1=None, milestone2=None)[source]¶ Lifts the motion planner’s lower-dimensional path back to the ambient space