Sure, evolution invented mammals that soar 200 feet through the air on giant flaps of skin and 3-foot-wide crabs that climb trees, but has it ever invented a four-legged animal with telescoping limbs? No, it has not. Biology can’t really work that way. But robots certainly can.

Meet the Dynamic Robot for Embodied Testing, aka DyRET, a machine that changes the length of its legs on the fly—not to creep out humans, but to help robots of all stripes not fall over so much. Writing today in the journal Nature Machine Intelligence, researchers in Norway and Australia describe how they got DyRET to learn how to lengthen or shorten its limbs to tackle different kinds of terrains. Then once they let the shape-shifting robot loose in the real world, it used that training to efficiently tread surfaces it had never seen before. (I.e., it managed to not collapse in a heap.)

“We can actually take the robot, bring it outside, and it will just start adapting,” says computer scientist Tønnes Nygaard of the University of Oslo and the Norwegian Defence Research Establishment, the lead author on the paper. “We saw that it was able to use the knowledge it previously learned.”

Walking animals don’t have extendable limbs because, first and foremost, it’s just not biologically possible. But it’s also not necessary. Thanks to millions of years of evolution honing our bodies, humans, cheetahs, and wolves all move with incredible agility, constantly scanning the ground ahead of us for obstacles as we run.

Go go gadget limbs…

Courtesy of University of Oslo

Robots, on the other hand, need some assistance. Even a super-sophisticated machine like the Boston Dynamics robot dog Spot has trouble navigating complex terrain. Giving robots telescoping legs both improves their stability as they move across different surfaces and boosts their energy efficiency. Stumbling around eats up a lot of battery power, and a flailing robot could hurt itself or nearby humans. “I think it’s a particularly good idea to have a body that is tunable,” says Francisco Valero-Cuevas, an engineer at the University of Southern California who develops quadrupedal robots but wasn’t involved in this new research. “That’s what’s happening here. A tunable body makes for a more versatile robot.”

Nygaard and his colleagues schooled DyRET by first literally building it experimental sandboxes. In the lab, they filled long boxes with concrete, gravel, and sand, representing a range of different terrains the bot might find in the real world. Concrete is the easy one—nice and flat and predictable. Stepping in sand is much more uncertain, as with each step the robot’s legs would sink in unique ways. Gravel is a physically tough surface, like concrete, but it’s also unpredictable, as the rocks can shift, complicating DyRET’s footfalls. “By having the three terrain examples, with different hardness and roughness, you get a pretty good representation of a sort of general interaction between the morphology, or the body, and the environment,” says Nygaard.