Robots are great (unless you're after a job!) but unfortunately they cannot deal with situations that they have not been programmed for. Robots can learn new tasks in two main ways.
The Teach-and-Learn method
A programmer writes a set of instructions, then watches the robot follow them. The instructions are then improved if needed.
The Learn-by-Example method
The robot is guided through the task once and produces its own instructions.