Centre of Mass Task

The position of the centre of mass, or centre of gravity (CoG), can be controlled with a IKBalanceTask. A balance task is added with

 IKBalanceTask* IKSolver::addBalanceTask(unsigned int global_up, bool with_moments, bool with_position,unsigned int priority).

To position the CoG, set with_position to true. By default, the figure is assigned a mass of 80 kg and each bone is assigned an individual mass that is proportional to its length. The centre of mass position is set halfway along the bone towards its closest child. The following methods change these defaults:

 IKSolver::setFigureMass(Real mass)
 IKSegment::setMass(Real mass)
 IKSegment::setCenter(Real x, Real y, Real z)

The segment centre of mass position is set in this segment's local space.

The CoG position subtask of the balance task has all the weighting parameters of a IKTask, i.e., weight, precision and priority, set with the IKTask methods. The position target is set with

 IKBalanceTask::setTarget(Real x, Real y, Real z).

Only one balance task is possible for a figure/solver.