Media playback is unsupported on your device Media caption The flexible wings tuck in and rebound when they are hit with a stick

Scientists have created a drone with flapping wings that can fold in and rebound following a mid-air collision.

By copying the wing anatomy of birds and bats, the researchers designed a mechanism to allow their flying robot to squeeze between obstacles and recover from impacts.

Details are published in the journal Bioinspiration and Biomimetics.

The wings are based on the ability of birds and bats to tuck their wings close into their bodies.

To achieve this, the Stanford University team built a light, flexible wing from carbon fibre and a thin membrane of plastic film.

Its bat-like design enables it to fold in and then recover, entirely passively - with no need for any other part of the robot to trigger the folding process.

The wings are attached to the drone's body with a 3D-printed wrist joint, which was also based on animal anatomy. It is hinged in such a way as to allow the rest of the wing to fold and unfold freely.

Dr David Lentink, the lead researcher on the project, said he was "surprised it worked so well'.

He added: "[We hit the robot wing] hard with a stick to see how well it could handle hard impact.

"[We] could basically use a rod like a baseball bat and hit the wing of the robot, and it would still recover just fine."

Dr Lentink explained to BBC News that the secret of this rapid, unfolding recovery was that "the wings are flapped at the root".

"This flapping induces centrifugal forces all over the wing," he explained, like the force that pulls you outward on a spinning playground roundabout.

"So as soon as the wing is folded along the designed origami-like fold line, it is forced outward by the centrifugal forces again and unfolds automatically."

Image copyright Lentink Lab Image caption The wings are based on flexible bird and bat wings that can tuck in to squeeze between obstacles

The researchers say their development will help make flapping winged drones much more robust.

There is a great deal of interest in military and search and rescue applications of small, flapping-wing drones that are able to hover and carry out quick, evasive manoeuvres.

Dr Lentink said that drones needed to become much more resilient "if we ever want to safely fly through a forest or land in a tree like a bird".