Weighting, activation/deactivating contacts#
Weighting contact#
By default, forces and moments generated by the solver has no cost (they are however internally weighted by the problem solver to make the problem feasible).
If you want to mitigate the forces produced by a specific contact, you can use the weight_forces attribute.
For unilateral contacts, you can use weight_tangentials attribute to
discourage high tangential forces.
Example: unweighted tangential forces
In this example, the tangential forces are not weighted.
Example: weighting tangential forces
By passing --weight_tangentials to the quadruped example, the tangential forces are weighted with a
cost of \(10^{-4}\).
This results in contact forces that are more normal to the contact surface.
For planar and fixed contacts, you can use the weight_moments attribute to
discourage high moments.
Sigmaban humanoid
In this example, the moments are weighted
using weight_moments to encourage the center of pressure to be at the
center of the foot.
Activating/desactivating or removing contacts#
Contacts can change during the simulation. You can activate or deactivate a contact by setting the
active attribute:
# At initialization
right_contact = solver.add_planar_contact(rightFoot_task)
...
# During execution, contact can be activated or deactivated
right_contact.active = False
Sigmaban humanoid
In the Sigmaban example again, the right foot contact is activated and deactivated during the motion
You can also remove a contact by using remove_contact:
# Remove the right foot contact
solver.remove_contact(right_contact)