A robot having an obstacle detection unit and a method of controlling the
robot. The robot includes a main body, a driving unit, an auxiliary body,
and a control unit. The driving unit drives the main body along a given
surface. The auxiliary body projects from the main body and detecting an
obstacle around the main body. The control unit controls the driving unit
according to results of the detection so that the main body and the
obstacle are maintained at a predetermined distance from each other.