PD Joint Torque with Limits

~8 mincode completion

Implement pd_torque(theta_target, theta, theta_dot, kp, kd, tau_max) returning the torque for every joint as an array.

Where this shows up

~8 min

6 employers weight this skill

4 autonomy companies, 2 defense companies. Top match scores 93.

Python
import numpy as np


def pd_torque(theta_target, theta, theta_dot, kp, kd, tau_max):
    """
    PD torque per joint, clipped to the motor limit.

    Args:
        theta_target: target joint angles, shape (n,)
        theta:        measured joint angles, shape (n,)
        theta_dot:    measured joint velocities, shape (n,)
        kp, kd:       PD gains
        tau_max:      torque limit, applied as [-tau_max, tau_max]

    Returns:
        array of shape (n,): clipped torques
    """
    # YOUR CODE HERE
    pass
Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.