Skip to content

Franka: reach and pick

Task-space control is supported through trusty.control, which reports how tracked points on a body move per unit change of each actuator target, measured on the converged step. The examples here use it to drive the Franka's hand to a pose: tracing a square, reaching around an obstacle, stacking cubes and lifting a soft toy.

python examples/robotics/reach.py
python examples/robotics/pick_place.py

Three points on the hand are tracked against the seven arm actuators:

trusty.control.track(world, body, points, inputs=franka.arm_actuators)

The controller in pose_control.py turns that sensitivity into a small quadratic program, solved with cvxpy, for the next change of joint targets. Gravity sag, contact and joint limits are already in the sensitivity, so the controller needs no kinematic model of the arm.

Reaching around an obstacle

Tracked points on every link, linearised with the same sensitivity, keep the whole arm 6 cm clear of a column. Click in the viewer to move the target.

controller = HandController(world, franka, keep_out=column_distance if column else None,
                            margin=MARGIN)
python examples/robotics/inverse_reach.py

Picking up cubes

Frictional grasping of rigid bodies is supported through contact with friction: the cubes are held by the friction of the two finger pads alone.

self.body = trusty.affine.add_affine_body(
    world, np.ascontiguousarray(V), np.ascontiguousarray(F),
    density=mass / size**3, stiffness=fr.BODY_STIFFNESS, friction_mu=mu)

A soft toy

The same grasp on a deformable foam toy, either a hexahedral solid or a reduced body (--body subspace):

if body == "fem":
    toy = trusty.fem.add_hex_solid(world, mesh, material, density=TOY_RHO, friction_mu=TOY_MU)
    positions = lambda: np.asarray(trusty.fem.positions(world, toy))    # noqa: E731
else:
    basis_world = trusty.World()
    trusty.fem.add_hex_solid(basis_world, mesh, material, density=TOY_RHO)
    basis = build_basis.build_skinning_eigenmodes(
        world=basis_world, rest_positions=np.asarray(mesh.vertices), num_handles=HANDLES)
    toy = trusty.subspace.add_hex_body(world, mesh, material, density=TOY_RHO, basis=basis,
                                       friction_mu=TOY_MU)
    positions = lambda: trusty.subspace.deformed_positions(world, toy)       # noqa: E731
python examples/robotics/soft_grasp.py