Skip to content

Franka arm

Articulated robots are built from affine bodies joined by revolute and prismatic joints, with joint limits and position actuators. Here a Franka FR3, loaded from its URDF, follows scripted joint targets.

python examples/robotics/franka_arm.py

Each URDF joint becomes a joint, a limit and an actuator:

if name in ARM_JOINTS:
    joint = trusty.affine.add_revolute_joint(
        world, child, tuple(T[:3, 3] - 0.05 * axis), tuple(T[:3, 3] + 0.05 * axis),
        body_j=parent, stiffness=JOINT_STIFFNESS)
    lower, upper = limits[name]
    trusty.affine.add_joint_limit(
        world, joint, max(lower - q[name], -ANGLE_RANGE), min(upper - q[name], ANGLE_RANGE),
        margin=ARM_LIMIT_MARGIN, stiffness=LIMIT_STIFFNESS)
    arm.append(trusty.actuators.add_joint_drive(
        world, joint, stiffness=ARM_GAINS[ARM_JOINTS.index(name)]))
else:
    joint = trusty.affine.add_prismatic_joint(
        world, child, tuple(pose[j.find("child").get("link")][:3, 3]), tuple(axis),
        body_j=parent, stiffness=JOINT_STIFFNESS)
    lower, upper = limits[name]
    trusty.affine.add_joint_limit(
        world, joint, max(lower, 5e-4) - finger0, upper - finger0, margin=finger_margin,
        stiffness=LIMIT_STIFFNESS)
    grip.append(trusty.actuators.add_joint_drive(world, joint, stiffness=FINGER_GAIN))

Each step sets the joint targets with trusty.actuators.set_joint_target. The drives are springs, so the joints sag slightly under gravity.

Soft fingers

Soft solids attach to rigid links with add_pin. Here two PneuNet fingers are pinned to the hand and inflated by pressure cavities while the arm moves.

body = trusty.fem.add_hex_solid(world, trusty.make_hex_mesh(local @ R.T + origin, hexes),
                                material, density=1080.0)
root = np.flatnonzero(V[:, 0] == 0.0).tolist()
constraints.add_pin(world, body, root, to=franka.hand)
fingers.append(body)
cavities.append(loads.add_pressure_cavity(world, body, cavity_faces(world, body)))
python examples/robotics/franka_pneunet.py