From spoons to stuffed animals, humans learn early in life how to pick up objects that have a variety of shapes, textures and sizes.

A new machine-learning algorithm developed by engineers at UC Berkeley can teach robots to grasp and carry items with similar dexterity.

The algorithm helps “ambidextrous” robots equipped with different types of grippers — for example, a suction gripper and a parallel-jaw gripper — decide which gripper to use for any given object.

“Any single gripper cannot handle all objects,” said Jeff Mahler, a postdoctoral researcher at UC Berkeley and lead author of a new paper describing the advance, published this week in Science Robotics. “For example, a suction cup cannot create a seal on porous objects such as clothing, and parallel-jaw grippers may not be able to reach both sides of some tools and toys. ‘Ambidextrous’ robots offer greater diversity.”

The technology could be especially useful in fulfillment centers for e-commerce companies like Amazon, which rely on robots for packaging.

“When you are in a warehouse putting together packages for delivery, objects vary considerably,” said Ken Goldberg, a UC Berkeley professor with joint appointments in the Department of Electrical Engineering and Computer Sciences and the Department of Industrial Engineering and Operations Research. “We need a variety of grippers to handle a variety of objects.”