Fixed and planar contacts#
Fixing the floating base#
Assuming a robot is fixed (no floating base), you can use the mask_fbase()
method to disable the floating base:
# Disable the floating base
solver.mask_fbase(True)
This will add a constraint on the floating base that should have no acceleration, and allow forces to be applied by the floating base to compensate for bias forces such as gravity.
Fixed contact#
To be used with: frame task
A fixed contact can be associated with a frame task, and will prevent the frame from moving.
# Create the base task
base_task = solver.add_frame_task("base", np.eye(4))
base_task.configure("base", "hard", 1.0, 1.0)
# Adds a fixed contact for this task
base_contact = solver.add_fixed_contact(base_task)
UR5 with fixed contact
In this example, a fixed contact is used on the base of the UR5 robot.
The contacts_viz helper is used to visualize the contacts.
Planar (unilateral) contact#
To be used with: frame task
# Create the left foot task
left_foot_task = solver.add_frame_task("left_foot", np.eye(4))
left_foot_task.configure("left_foot", "hard", 1.0, 1.0)
# Create the unilateral contact
left_foot_contact = solver.add_planar_contact(left_foot_task)
# Adjusting the contact rectangular size, expressed in the local frame
# length is the contact dimension along x axis
# width is the contact dimension along y axis
left_foot_contact.length = 0.1
left_foot_contact.width = 0.05
# Adjusting the friction coefficient (default is 1.0)
left_foot_contact.mu = 0.5
Sigmaban humanoid
In this example, planar contacts are used to model the feet contacts of the Sigmaban humanoid.