DART
6.10.1
|
The CompositeIK class allows you to specify an arbitrary hierarchy of InverseKinematics modules for a single Skeleton. More...
#include <HierarchicalIK.hpp>
Public Types | |
typedef std::unordered_set< std::shared_ptr< InverseKinematics > > | ModuleSet |
typedef std::unordered_set< std::shared_ptr< const InverseKinematics > > | ConstModuleSet |
Public Member Functions | |
std::shared_ptr< HierarchicalIK > | clone (const SkeletonPtr &_newSkel) const override |
Clone this HierarchicalIK module. More... | |
virtual std::shared_ptr< CompositeIK > | cloneCompositeIK (const SkeletonPtr &_newSkel) const |
Same as clone(), but passes back a more complete type. More... | |
bool | addModule (const std::shared_ptr< InverseKinematics > &_ik) |
Add an IK module to this CompositeIK. More... | |
const ModuleSet & | getModuleSet () |
Get the set of modules being used by this CompositeIK. More... | |
ConstModuleSet | getModuleSet () const |
Get the set of modules being used by this CompositeIK. More... | |
void | refreshIKHierarchy () override |
Refresh the IK hierarchy of this IK module. More... | |
bool | solve (bool applySolution=true) |
Solve the IK Problem. More... | |
bool | solve (Eigen::VectorXd &positions, bool applySolution=true) |
Same as solve(bool), but the positions vector will be filled with the solved positions. More... | |
bool | findSolution (Eigen::VectorXd &positions) |
Finds a solution of the IK problem without applying the solution. More... | |
bool | solveAndApply (bool allowIncompleteResult=true) |
Identical to findSolution(), but this function applies the solution when the solver successfully found a solution or allowIncompleteResult is set to true. More... | |
bool | solveAndApply (Eigen::VectorXd &positions, bool allowIncompleteResult=true) |
Identical to solveAndApply(bool), but position will be filled with the solved positions. More... | |
void | setObjective (const std::shared_ptr< optimizer::Function > &_objective) |
Set the objective function for this HierarchicalIK. More... | |
const std::shared_ptr< optimizer::Function > & | getObjective () |
Get the objective function for this HierarchicalIK. More... | |
std::shared_ptr< const optimizer::Function > | getObjective () const |
Get the objective function for this HierarchicalIK. More... | |
void | setNullSpaceObjective (const std::shared_ptr< optimizer::Function > &_nsObjective) |
Set the null space objective for this HierarchicalIK. More... | |
const std::shared_ptr< optimizer::Function > & | getNullSpaceObjective () |
Get the null space objective for this HierarchicalIK. More... | |
std::shared_ptr< const optimizer::Function > | getNullSpaceObjective () const |
Get the null space objective for this HierarchicalIK. More... | |
bool | hasNullSpaceObjective () const |
Returns true if this HierarchicalIK has a null space objective. More... | |
const std::shared_ptr< optimizer::Problem > & | getProblem () |
Get the Problem that is being maintained by this HierarchicalIK module. More... | |
std::shared_ptr< const optimizer::Problem > | getProblem () const |
Get the Problem that is being maintained by this HierarchicalIK module. More... | |
void | resetProblem (bool _clearSeeds=false) |
Reset the Problem that is being maintained by this HierarchicalIK module. More... | |
void | setSolver (const std::shared_ptr< optimizer::Solver > &_newSolver) |
Set the Solver that should be used by this IK module, and set it up with the Problem that is configured by this IK module. More... | |
const std::shared_ptr< optimizer::Solver > & | getSolver () |
Get the Solver that is being used by this IK module. More... | |
std::shared_ptr< const optimizer::Solver > | getSolver () const |
Get the Solver that is being used by this IK module. More... | |
const IKHierarchy & | getIKHierarchy () const |
Get the IK hierarchy of this IK module. More... | |
const std::vector< Eigen::MatrixXd > & | computeNullSpaces () const |
Compute the null spaces of each level of the hierarchy. More... | |
Eigen::VectorXd | getPositions () const |
Get the current joint positions of the Skeleton associated with this IK module. More... | |
void | setPositions (const Eigen::VectorXd &_q) |
Set the current joint positions of the Skeleton associated with this IK module. More... | |
SkeletonPtr | getSkeleton () |
Get the Skeleton that this IK module is associated with. More... | |
ConstSkeletonPtr | getSkeleton () const |
Get the Skeleton that this IK module is associated with. More... | |
SkeletonPtr | getAffiliation () |
This is the same as getSkeleton(). More... | |
ConstSkeletonPtr | getAffiliation () const |
This is the same as getSkeleton(). More... | |
void | clearCaches () |
Clear the caches of this IK module. More... | |
Static Public Member Functions | |
static std::shared_ptr< CompositeIK > | create (const SkeletonPtr &_skel) |
Create a CompositeIK module. More... | |
Protected Member Functions | |
CompositeIK (const SkeletonPtr &_skel) | |
Constructor. More... | |
void | initialize (const std::shared_ptr< HierarchicalIK > &my_ptr) |
Setup the module. More... | |
void | copyOverSetup (const std::shared_ptr< HierarchicalIK > &_otherIK) const |
Copy the setup of this HierarchicalIK module into another HierarchicalIK module. More... | |
void | sendDestructionNotification () const |
Send a destruction notification to all Observers. More... | |
void | addObserver (Observer *_observer) const |
Add an Observer to the list of Observers. More... | |
void | removeObserver (Observer *_observer) const |
Remove an Observer from the list of Observers. More... | |
Protected Attributes | |
std::unordered_set< std::shared_ptr< InverseKinematics > > | mModuleSet |
The set of modules being used by this CompositeIK. More... | |
WeakSkeletonPtr | mSkeleton |
Pointer to the Skeleton that this IK is tied to. More... | |
IKHierarchy | mHierarchy |
Cache for the IK hierarcy. More... | |
std::shared_ptr< optimizer::Problem > | mProblem |
The Problem that this IK module is maintaining. More... | |
std::shared_ptr< optimizer::Solver > | mSolver |
The Solver that this IK module will use. More... | |
optimizer::FunctionPtr | mObjective |
The Objective of this IK module. More... | |
optimizer::FunctionPtr | mNullSpaceObjective |
The null space Objective of this IK module. More... | |
std::weak_ptr< HierarchicalIK > | mPtr |
Weak pointer to self. More... | |
Eigen::VectorXd | mLastPositions |
Cache for the last positions. More... | |
std::vector< Eigen::MatrixXd > | mNullSpaceCache |
Cache for null space computations. More... | |
Eigen::MatrixXd | mPartialNullspaceCache |
Cache for a partial null space computation. More... | |
Eigen::JacobiSVD< math::Jacobian > | mSVDCache |
Cache for the null space SVD. More... | |
math::Jacobian | mJacCache |
Cache for Jacobians. More... | |
std::set< Observer * > | mObservers |
List of current Observers. More... | |
The CompositeIK class allows you to specify an arbitrary hierarchy of InverseKinematics modules for a single Skeleton.
Simply add in each IK module that should be used.
typedef std::unordered_set<std::shared_ptr<const InverseKinematics> > dart::dynamics::CompositeIK::ConstModuleSet |
typedef std::unordered_set<std::shared_ptr<InverseKinematics> > dart::dynamics::CompositeIK::ModuleSet |
|
protected |
Constructor.
bool dart::dynamics::CompositeIK::addModule | ( | const std::shared_ptr< InverseKinematics > & | _ik | ) |
Add an IK module to this CompositeIK.
This function will return true if the module belongs to the Skeleton that this CompositeIK is associated with, otherwise it will return false.
|
protectedinherited |
Add an Observer to the list of Observers.
|
inherited |
Clear the caches of this IK module.
It should generally not be necessary to call this function.
|
overridevirtual |
Clone this HierarchicalIK module.
Implements dart::dynamics::HierarchicalIK.
|
virtual |
Same as clone(), but passes back a more complete type.
|
inherited |
Compute the null spaces of each level of the hierarchy.
|
protectedinherited |
Copy the setup of this HierarchicalIK module into another HierarchicalIK module.
|
static |
Create a CompositeIK module.
|
inherited |
Finds a solution of the IK problem without applying the solution.
[out] | positions | The solution of the IK problem. If the solver failed to find a solution then it will still set the position with the best guess. For example, iterative solvers will fill position with the last result of the iterations. |
|
inherited |
This is the same as getSkeleton().
It is used by the HierarchicalIKPtr to provide a common interface for the various IK smart pointer types.
|
inherited |
This is the same as getSkeleton().
It is used by the HierarchicalIKPtr to provide a common interface for the various IK smart pointer types.
|
inherited |
Get the IK hierarchy of this IK module.
const CompositeIK::ModuleSet & dart::dynamics::CompositeIK::getModuleSet | ( | ) |
Get the set of modules being used by this CompositeIK.
CompositeIK::ConstModuleSet dart::dynamics::CompositeIK::getModuleSet | ( | ) | const |
Get the set of modules being used by this CompositeIK.
|
inherited |
Get the null space objective for this HierarchicalIK.
|
inherited |
Get the null space objective for this HierarchicalIK.
|
inherited |
Get the objective function for this HierarchicalIK.
|
inherited |
Get the objective function for this HierarchicalIK.
|
inherited |
Get the current joint positions of the Skeleton associated with this IK module.
|
inherited |
Get the Problem that is being maintained by this HierarchicalIK module.
|
inherited |
Get the Problem that is being maintained by this HierarchicalIK module.
|
inherited |
Get the Skeleton that this IK module is associated with.
|
inherited |
Get the Skeleton that this IK module is associated with.
|
inherited |
Get the Solver that is being used by this IK module.
|
inherited |
Get the Solver that is being used by this IK module.
|
inherited |
Returns true if this HierarchicalIK has a null space objective.
|
protectedinherited |
Setup the module.
|
overridevirtual |
Refresh the IK hierarchy of this IK module.
Implements dart::dynamics::HierarchicalIK.
|
protectedinherited |
Remove an Observer from the list of Observers.
|
inherited |
Reset the Problem that is being maintained by this HierarchicalIK module.
This will clear out all Functions from the Problem and then configure the Problem to use this IK module's Objective and Constraint functions.
Setting _clearSeeds to true will clear out any seeds that have been loaded into the Problem.
|
protectedinherited |
Send a destruction notification to all Observers.
This will cause all Observers to behave as if this Subject has been permanently deleted, so it should only be called when that behavior is desired.
|
inherited |
Set the null space objective for this HierarchicalIK.
|
inherited |
Set the objective function for this HierarchicalIK.
|
inherited |
|
inherited |
Set the Solver that should be used by this IK module, and set it up with the Problem that is configured by this IK module.
|
inherited |
Solve the IK Problem.
By default, the Skeleton itself will retain the solved joint positions. If you pass in false for applySolution
, then the joint positions will be return to their original positions after the problem is solved.
|
inherited |
Same as solve(bool), but the positions vector will be filled with the solved positions.
|
inherited |
Identical to findSolution(), but this function applies the solution when the solver successfully found a solution or allowIncompleteResult
is set to true.
[in] | allowIncompleteResult | Allow to apply the solution even when the solver failed to find solution. This option would be useful when an iterative solver is used because they will often do a decent job of getting a result close to a solution even if it failed to find the solution. |
|
inherited |
Identical to solveAndApply(bool), but position
will be filled with the solved positions.
[out] | positions | The solution of the IK problem. If the solver failed to find a solution then it will still set the position with the best guess. For example, iterative solvers will fill positions with the last result of the iterations. |
[in] | allowIncompleteResult | Allow to apply the solution even when the solver failed to find solution. This option would be useful when an iterative solver is used because they will often do a decent job of getting a result close to a solution even if it failed to find the solution. |
|
protectedinherited |
Cache for the IK hierarcy.
|
mutableprotectedinherited |
Cache for Jacobians.
|
mutableprotectedinherited |
Cache for the last positions.
|
protected |
The set of modules being used by this CompositeIK.
|
mutableprotectedinherited |
Cache for null space computations.
|
protectedinherited |
The null space Objective of this IK module.
|
protectedinherited |
The Objective of this IK module.
|
mutableprotectedinherited |
List of current Observers.
|
mutableprotectedinherited |
Cache for a partial null space computation.
|
protectedinherited |
The Problem that this IK module is maintaining.
|
protectedinherited |
Weak pointer to self.
|
protectedinherited |
Pointer to the Skeleton that this IK is tied to.
|
protectedinherited |
The Solver that this IK module will use.
|
mutableprotectedinherited |
Cache for the null space SVD.