At a vast greenhouse in the central Danish city of Odense, a squad of robots move thin plastic pots of herbs for shipping without even putting a dent in them. For moviegoers used to seeing humanoid machines in action, that might not seem special — but in truth, it is a remarkable feat.

Robots until recently have been limited to precise, preprogrammed and repetitive heavy-duty jobs like automotive manufacturing. Yet at the Rosborg Food greenhouse, the OnRobot devices adjust on the fly. One pot might be slightly out of position. The next might be a little heavy.

Robots that can see, learn and grip different items are advancing quickly into the retail, food-and-beverage and consumer-packaged-good industries. While deliveries of robots to the U.S. auto industry fell 12 percent last year, shipments to food and consumer-product companies soared 48 percent.