Torque task#
The DynamicsTorqueTask is a task that can be used to impose a target torque.
This is useful to represent joints that are passive, like a bearing, a spring or a dampener.
Task initialization#
The torque task can be initialized by calling add_com_task() on the
solver, which takes no argument:
# Creating a torque task
torque_task = solver.add_torque_task()
Task update#
The task can be updated by calling set_torque():
# Setting the torque to 0.0
torque_task.set_torque("left_knee", 0.0)
# Don't forget that the task is actually soft by default, like the others
# If you want to enforce strictly zero torque, make the task hard
torque_task.configure("torque", "hard")
Alternatively, extra parameters kp and kd can be passed to the set_torque method:
# Setting the torque to 0.0 with a stiffness of 1.0 and a damping of 0.1
# The joint will act as some kind of passive spring
torque_task.set_torque("left_knee", 0.0, 1.0, 0.1)
# Setting the torque to 0.0 with a stiffness of 0.0 and a damping of 0.1
# The joint will have zero torque, and act as a dampener
torque_task.set_torque("left_knee", 0.0, 0.0, 0.1)
To stop applying torque, you can call the reset_torque() method:
# Reset the torque (stop acting on the joint)
torque_task.reset_torque("left_knee")
Example#
Humanoid with external force applied
In this example, a torque task is used to set the motors torque to zero. In the mean time, an external contact is applied on the robot’s foot.
Megabot
In this robot, many passive joints are used. The torque is enforced to zero by a torque task.