Klamp't
0.9.0
|
A very general multi-section path container. More...
#include <MultiPath.h>
Classes | |
struct | PathSection |
Public Types | |
enum | InterpPolicy { InterpLinear, InterpCubic } |
Public Member Functions | |
bool | Load (const string &fn) |
bool | Save (const string &fn) const |
bool | Load (TiXmlElement *in) |
bool | Save (TiXmlElement *out) const |
size_t | NumSections () const |
bool | IsValid () const |
Tests whether the path has a valid set of milestones and constraints. | |
bool | IsContinuous (Real tol=0.0) const |
bool | HasTiming (int section=0) const |
Returns true if the specified section has timing information. | |
bool | HasVelocity (int section=0) const |
Returns true if the specified section has velocity information. | |
bool | HasConstraints (int section=0) const |
Returns true if the specified section has any constraints (ik or holds) | |
bool | HasContacts (int section=0) const |
Returns true if the specified section has hold information. | |
void | GetMilestones (vector< Vector > &milestones, int section=0) const |
Returns the set of untimed milestones along the given section. | |
void | GetTimedMilestones (vector< Real > ×, vector< Vector > &milestones, int section=0) const |
bool | GetDynamicPath (ParabolicRamp::DynamicPath &path, int section=0) const |
void | SetMilestones (const vector< Vector > &milestones, int section=0) |
void | SetTimedMilestones (const vector< Real > ×, const vector< Vector > &milestones, int section=0) |
void | SetDynamicPath (const ParabolicRamp::DynamicPath &path, int section=0) |
Real | StartTime () const |
Returns the start time of the path. If untimed, the start time is 0. | |
Real | EndTime () const |
Returns the end time of the path. If untimed, the end time is 1. | |
Real | Duration () const |
Returns the duration of the path. If untimed, the duration is 1. | |
void | SetDuration (Real duration, bool uniformSectionTimes=true) |
void | SetSmoothTiming (Real duration, bool uniformSectionTimes=true) |
void | Concat (const MultiPath &suffix, bool relative=true) |
void | GetIKProblem (vector< IKGoal > &goals, int section=0) const |
Retrieves all of the IK goals from the problem, including holds. | |
void | SetIKProblem (const vector< IKGoal > &goals, int section=0) |
void | GetStance (Stance &stance, int section=0) const |
Retrieves the section's stance, including other ikGoal constraints. | |
void | SetStance (const Stance &stance, int section=0) |
void | SetHold (const string &str, const Hold &h) |
Sets a named global hold. | |
bool | GetHold (const string &str, Hold &h) const |
Retreives a named global hold. | |
int | TimeToSection (Real time) const |
int | Evaluate (Real time, GeneralizedCubicBezierCurve &curve, Real &duration, Real &u, InterpPolicy policy=InterpCubic) const |
int | Evaluate (Real time, Vector &q, InterpPolicy policy=InterpCubic) const |
int | Evaluate (Real time, Vector &q, Vector &v, InterpPolicy policy=InterpCubic) const |
Public Attributes | |
PropertyMap | settings |
vector< PathSection > | sections |
vector< Hold > | holdSet |
vector< string > | holdSetNames |
A very general multi-section path container.
Path sections can be time-parameterized, have velocities, and can also have section-specific constraints.
A non-time-parameterized path with velocities is assumed to be just a linear interpolation in config x velocity space (q,v).
Section-specific constraints are either ikGoals, holds or both. To save space a multipath may also define holds as indexes into the holdSet data structure.
Load/Save to XML files is supported.
void Klampt::MultiPath::Concat | ( | const MultiPath & | suffix, |
bool | relative = true |
||
) |
Concatenates another multipath. If this is a timed path, the suffix path must be timed as well. In such a case, if relative = true then timing of the suffix path is shifted forward by time this->Duration() before concatenating it.
int Klampt::MultiPath::Evaluate | ( | Real | time, |
GeneralizedCubicBezierCurve & | curve, | ||
Real & | duration, | ||
Real & | u, | ||
InterpPolicy | policy = InterpCubic |
||
) | const |
Generates a hermite interpolator with "natural" tangents if velocities are not present. Returns the section index
bool Klampt::MultiPath::GetDynamicPath | ( | ParabolicRamp::DynamicPath & | path, |
int | section = 0 |
||
) | const |
Computes a DynamicPath from the given section. path.velMax and path.accMax need to be set.
void Klampt::MultiPath::GetTimedMilestones | ( | vector< Real > & | times, |
vector< Vector > & | milestones, | ||
int | section = 0 |
||
) | const |
Returns the set of timed milestones along the given section. If the section is untimed, the times are set uniformly in the range [0,1].
bool Klampt::MultiPath::IsContinuous | ( | Real | tol = 0.0 | ) | const |
Tests whether the milestone, times, and velocities are continuous within the tolerance tol
void Klampt::MultiPath::SetDuration | ( | Real | duration, |
bool | uniformSectionTimes = true |
||
) |
Sets the duration of the path by scaling. If untimed, milestone times are assigned. If untimed and uniformSectionTimes = false, section durations are assigned proportional to the number of section milestones. Otherwise, section durations are uniform
void Klampt::MultiPath::SetDynamicPath | ( | const ParabolicRamp::DynamicPath & | path, |
int | section = 0 |
||
) |
Sets the given section to a DynamicPath (untimed). Dynamic resizing is supported if section=sections.size().
void Klampt::MultiPath::SetIKProblem | ( | const vector< IKGoal > & | goals, |
int | section = 0 |
||
) |
Sets the section to just an IK constrained section (holds are deleted). Dynamic resizing is supported if section=sections.size().
void Klampt::MultiPath::SetMilestones | ( | const vector< Vector > & | milestones, |
int | section = 0 |
||
) |
Sets the given section to an untimed path. Dynamic resizing is supported if section=sections.size()
void Klampt::MultiPath::SetSmoothTiming | ( | Real | duration, |
bool | uniformSectionTimes = true |
||
) |
Sets the timing of the path by smoothly accelerating and decelerating to a stop between sections. Existing timing is overwritten. See for a description of uniformSectionTimes.
void Klampt::MultiPath::SetStance | ( | const Stance & | stance, |
int | section = 0 |
||
) |
Sets the section to a stance section (ikGoals are deleted). Dynamic resizing is supported if section=sections.size().
void Klampt::MultiPath::SetTimedMilestones | ( | const vector< Real > & | times, |
const vector< Vector > & | milestones, | ||
int | section = 0 |
||
) |
Sets the given section to a timed path. Note: timing is absolute. Dynamic resizing is supported if section=sections.size().
int Klampt::MultiPath::TimeToSection | ( | Real | time | ) | const |
Returns the section corresponding to the current time. If untimed, the time range is [0,1]. Does not support mixed timed and untimed paths.