Isaac Asimov must be turning in his grave. In blatant contravention of the sci-fi writer's first law of robotics, Sami Haddadin's robot regularly hits him in the face.

The blows are no accident. Haddadin is part of a research team at the German Aerospace Centre Space Agency (DLR) in Oberpfaffenhofen aiming to transform industrial robots from insensitive drones into smart machines that can work alongside humans. He is testing the first industrial robot capable of sensing when it hits someone.

"Accidents happen," he says. "We have to accept that when people start to work more closely with robots they will sometimes hit people."

Combining human and robot skills could help a range of industries unable to benefit from existing robots, says Ken Young, who works on industrial robots at the University of Warwick, UK. "We can't automate everything - the answer is to automate what you can and if you need humans to help, work out how to make that possible."

Today's industrial robots are a far cry from anything people could work with. Safety at a typical car factory, where robots work tirelessly at high speeds penned in behind physical barriers, consists of keeping people and robots apart. If a person breaches a barrier, sometimes an alarm sounds and the robots stop. But if someone was hit, the robots would just soldier on blissfully unaware.

To tackle this, the DLR researchers started by smashing five industrial arms weighing up to 2.5 tonnes into the head of a crash test dummy at different speeds. To the researchers' surprise, none was capable of delivering a blow rated worse than "very low" on the scale used by the car industry. Roboticists had assumed such impacts would be lethal, says Haddadin.

Although this was reassuring, an industrial robot could still trap or crush a person by being unaware that it had hit them. So the next step was giving a robotic arm the ability to detect an impact and react appropriately.

A person landing a blow feels the shock of the impact thanks to specialised stretch receptors in their muscles and joints. Haddadin has given a robot arm the same "kinaesthetic" sense by embedding torque sensors in each of its six joints. Made from a collection of metal foil devices that change their electrical resistance when under tension in a particular direction, they give constant feedback on the direction and magnitude of the forces felt by the arm.

Industrial robots are typically programmed to carry out a series of set movements. Haddadin recorded the pattern of torque changes his robot arm feels during normal activity and programmed it to stop moving if it senses something unexpected. Then he gamely put the arm to the test, allowing it to hit him in the stomach, chest, forehead and arm at speeds of up to 2.5 metres per second. Luckily, it performed as expected (see pictures). Though he was "definitely concerned" when the blows began, Haddadin says "it took me only a very short time to get used to them".

Once it has stopped, the arm uses its motors and torque sensors to support its own weight. This ensures it doesn't keep moving due to gravity or inertia and cause further harm. Then the arm can simply be pushed aside. "You give it a push and it just floats away. It feels like it weighs only a few grams," says Haddadin. The robot can also feel the direction it is being pushed in and use its motors to help out.

The arm also uses its torque sensors for more sophisticated responses. The direction of an unexpected movement allows it to differentiate a co-worker's guiding hand from an unintended collision, preventing it from stopping unnecessarily. Meanwhile the magnitude of the movement allows it to tell the difference between a big hit and a soft collision. It responds to the latter with a gentle nudge that signals "get out of my way" to its human co-worker. A commercial version of the arm will be launched next year by robot manufacturer Kuka of Augsburg, Germany.

Such arms could find uses outside factories too, such as in the home. Also adding magnets and magnetic sensors that track position would allow the arm to perform new factory tasks such as moving objects together.

What's more, a robot with a feel for its work could speed up the assembly of its own kind. "It is a little ironic that industrial robots are assembled entirely by humans," says Haddadin.

Still, sci-fi fans should know the risks of letting robots build each other.