Klamp't  0.8.1
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
MultiPath Class Reference

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 > &times, 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 > &times, 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< PathSectionsections
 
vector< HoldholdSet
 
vector< string > holdSetNames
 

Detailed Description

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.

Member Function Documentation

void 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 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 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 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 MultiPath::IsContinuous ( Real  tol = 0.0) const

Tests whether the milestone, times, and velocities are continuous within the tolerance tol

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


The documentation for this class was generated from the following file: