PURPOSE: A method for generating the path of a robot and the robot are provided to move robot with avoiding an object at the shortest distance and time as the location of the object is stochastically presumed when the robot moves. CONSTITUTION: A method for generating the path of a robot is as follows. The distance between the robot and an object is measured. A depth map having a plurality of cells is generated(100). The boundary between a plurality of the cells is divided according to the depth value of each cell. A single closed loop formed by the boundaries is extracted. The location and shape of the object is obtained through the single closed loop at a first time(200). The position probability of the object is calculated based on the location and shape of the object at a second time(300). The path of the robot is generated according to the location probability of the object(400).