Task weighting and priorities

Normally, each task is assigned an importance weighting with

 IKTask::setWeight(Real value). 

This determines how closely the target is satisfied and, at the same time, weights the given task against all other tasks. The residual error for each task will be proportional to task weight, which can also be set per each degree of freedom with

 IKTask::setDofWeight(unsigned int axis,Real value).

Another option is to rescale all task weights once a task is assigned a different weight. This makes the weighting of one task against others more pronounced. This option is enabled with

 IKSolver::rescaleTasks(bool value).

The influence of one task's weight on the others might be undesirable, for example, when moving a hand makes the feet violate the floor constraints. To prevent this, tasks can be grouped into low and high priority tasks with

 IKTask::setPriority(unsigned int p) 

or, per each degree of freedom, with

 IKTask::setDofPriorities(unsigned int x, unsigned int y, unsigned int z). 

Priority 0 is primary, priority 1 - secondary. Low priority tasks will be satisfied as long as they don't affect the high priority ones, otherwise the conflict will be resolved in favour of the first priority.

The relative importance of secondary tasks with respect to primary tasks can be tuned with

 IKSolver::setSecondaryTaskWeight(Real value)


 IKSolver::setSecondaryTaskPrecision(Real value). 

A large value passed to the first method will make the secondary tasks approach primary priority, a large value passed to the second method will increase the importance of secondary tasks at the cost of satisfying joint limits, as secondary tasks share the same space with joint limits solving.

In addition, task compliance can be varied with

 IKTask::setPrecision(Real value)


 IKTask::setDofPrecision(unsigned int axis, Real value)

For a large precision value, the task will be more responsive and track the target more readily and with a smaller offset than with low precision.