Tasks and constraints#

Tasks#

As you saw in the introduction example, a task defines something that the robot should do, like “reaching a given target with the effector”. In the context of the dynamics solver, a task eventually boils down into expressing a desired acceleration.

As explained in the introduction, a task structure will look like:

\(\ddot x^{desired} = K_p (x^{task} - x) + K_d (\dot x^{task} - \dot x) + \ddot x^{task}\).

Where the \(task\) superscript denotes the values produced by the task, and \(x\) is the quantity you want to control (joint position, effector position, effector orientation etc.). In a joint task, these values are simply the desired joint position, velocity and acceleration, i.e \(x = q\).

Each task has a kp attribute, allowing to adjust the proportional gain and adjust the task’s “stiffness”. By default, the derivative gain kd is set to \(2 \sqrt{K_p}\) to have a critically damped system. To change this behaviour, you can set the kd attribute to the desired value (setting it to a negative value will restore the default critical damping behaviour).

Priority

Description

hard

Task that must be satisfied by the solver (error should be brought to zero). If it is not possible, the solver will fail.

soft

Task that can be violated by the solver, but it will try to minimize the error. The relative importance of soft tasks is defined by their weight.

Constraints#

Constraints are specific limits that you want your robot to respect. While joint limits and velocity constraints are implemented in the solver itself, other specific constraints can be added to the solver.

Those can be prioritized and weighted in the exact same way as tasks, as explained above.

Removing tasks and constraints#

Tasks and constraints can be removed from the solver by using remove_task and remove_constraint:

# Removing a task
solver.remove_task(some_task)

# Removing a constraint
solver.remove_constraint(some_constraint)