klampt.model.multipath module
This module defines the MultiPath class, and methods for loading and saving multipaths from xml files.
- class klampt.model.multipath.MultiPath[source]
Bases:
object
A sophisticated path representation that allows timed/untimed paths, attached velocity information, as well as making and breaking contact.
Primarily, a MultiPath consists of a list of Sections, each of which is a path or timed trajectory along a fixed stance.
A Section can either contain the Holds defining its stance, or its stance could be defined by indices into the holdSet member of MultiPath. If all Sections have the latter structure it is known as an “aggregated” MultiPath.
- sections
the segments of the multipath, each operating over a fixed stance.
- Type:
list of Sections
- settings
an unstructured propery map ‘settings’ which can contain metadata about which robot this path applies to, how the path was created, etc.
- Type:
dict mapping str to str
- holdSet
a set of indexed Holds, which can be referred to inside Section objects.
- Type:
dict mapping int to Hold
- class Section[source]
Bases:
object
Contains a path or time-parameterized trajectory, as well as a list of holds and ik constraints
If the times member is set, this is time parameterized. Otherwise, it is just a path.
- settings
an unstructured property map.
- Type:
dict mapping str to str
- configs
a list of N configurations along the path section.
- Type:
list of lists of floats
- velocities
a list of N joint velocities along the path section.
- Type:
list of lists of floats, optional
- times
along the path section.
- Type:
list of floats, optional
- holds
the set of Holds that this section is required to meet.
- Type:
list of Holds, optional
- holdIndices
the set of Holds that this section is required to meet, indexed into MultiPath.holdSet.
- Type:
list of ints, optional
- ikObjectives
the set of extra IKObjectives that this section is required to meet.
- Type:
list of IKObjectives, optional
- isContinuous()[source]
Returns true if all the sections are continuous (i.e., the last config of each section matches the start config of the next).
- Return type:
bool
- getSectionTiming(section)[source]
Returns a pair (tstart,tend) giving the timing of the section
- Return type:
Tuple
[float
,float
]
- aggregateHolds(holdSimilarityThreshold=None)[source]
Aggregates holds from all sections to the global holdSet variable, and converts sections to use holdIndices. If holdSimilarityThreshold is not None, then sections’ holds that are the same within the given tolerance are combined into one hold.
- deaggregateHolds()[source]
De-aggregates holds from the global holdSet variable into the sections’ holds.
- setConfig(section, configIndex, q, v=None, t=None, maintainContinuity=True)[source]
Sets a configuration along the path, maintaining continuity if maintainContinuity is true. Equivalent to self.sections[section].configs[configIndex] = q except that adjacent sections’ configurations are also modified.
- timeToSegment(t)[source]
Returns a (section index,milestone index,param) tuple such that interpolation between the section’s milestone and its successor corresponds to time t.
- setTrajectory(trajectory)[source]
Set this MultiPath to a single-section trajectory. If trajectory is a HermiteTrajectory, velocities will be extracted.
- getTrajectory(robot=None, eps=None)[source]
Returns a trajectory representation of this MultiPath. If robot is provided, then a RobotTrajectory is returned. Otherwise, if velocity information is given, then a HermiteTrajectory is returned. Otherwise, a Trajectory is returned.
If robot and eps is given, then the IK constraints along the trajectory are solved and the path is discretized at resolution eps.
- Return type: