A robot that can imagine its own body has been created by scientists in a first step towards machine self-awareness.

The device consists of a jointed artificial arm and grasping “hand” similar to those used in numerous production plants.

What makes this robot different to thousands of others is that it knows that is what it is.

US scientists gave it the ability to “imagine itself” using a process of self-simulation. The advance is said to be a step towards self-aware machines.

Professor Hod Lipson, director of the Creative Machines Lab at the University of Columbia, New York – where the research was conducted, said: “If we want robots to become independent, to adapt quickly to scenarios unforeseen by their creators, then it’s essential that they learn to simulate themselves.

“While our robot’s ability to imagine itself is still crude compared to humans, we believe that this ability is on the path to machine self-awareness.”

Self-aware robots such as those depicted in the Terminator movies have long been the stuff of science fiction (Stephen Bowler/Wikimedia Commons/PA)

At the start of the study, the robot had no idea what shape it was, whether a spider, a snake or an arm.

To begin with, it behaved like a “babbling infant”, moving randomly while attempting various tasks.

Within about a day of intensive “deep learning”, the robot built up an internal picture of its structure and abilities.

After 35 hours of training, the “self model” helped the robot grasp objects from specific locations and drop them in a receptacle with 100% accuracy.

Even when relying entirely on its internal self model – the machine’s “imagination” – the robot was able to complete the pick-and-place task with a 44% success rate.

PhD student Robert Kwiatkowski, another member of the team, said: “That’s like trying to pick up a glass of water with your eyes closed, a process difficult even for humans.”

Other tasks included writing text on a board using a marker.

To test whether the robot could detect damage to itself, the scientists replaced part of its body with a deformed version.

The machine was able to recognise the change and work around it, with little loss of performance.

Self-aware robots may shed new light on the age-old mystery of consciousness, said Prof Lipson.

He added: “Philosophers, psychologists, and cognitive scientists have been pondering the nature of self-awareness for millennia, but have made relatively little progress.

“We still cloak our lack of understanding with subjective terms like ‘canvas of reality’, but robots now force us to translate these vague notions into concrete algorithms and mechanisms.”

Self-aware robots and computers running amok or threatening the human race have been a rich source of material for sci-fi novels and films.

The scientists say they are aware of the potential dangers involved in giving robots the gift of self-awareness.

Writing in the journal Science Robotics, they warn: “Self-awareness will lead to more resilient and adaptive systems, but also implies some loss of control.

“It’s a powerful technology, but it should be handled with care.”