A robot cleaner comprising: a main body; a drive wheel (151, 152) installed on the main body; a drive motor (153, 154) configured to rotate the drive wheel (151, 152); a travelling sensor configured to detect rotation of the drive wheel (151, 152); a first optical sensor configured to detect an obstacle located in a moving direction in which the main body moves; a cleaning tool configured to clean a floor; a second optical sensor configured to acquire an image of the floor and output a motion vector of the main body; the robot cleaner characterized by a collision sensor configured to detect a collision with the obstacle; and at least one processor electrically connected to the drive motor (153, 154), the travelling sensor, the first optical sensor, the second optical sensor and the collision sensor, wherein the at least one processor is configured to: determine a first moving distance moved by the main body based on an output of the travelling sensor; in response to detecting the obstacle, determine a second moving distance, by which the main body moves toward the obstacle after the detecting of the obstacle, based on the output from the second optical sensor; and control the cleaning tool to clean the floor in a vicinity of the obstacle in response to the second moving distance being greater than or equal to a threshold distance, which is based on a distance to the obstacle identified by the first optical sensor at a time when the obstacle is detected; and control the cleaning tool to clean the floor in the vicinity of the obstacle in response to the second moving distance being less than the threshold distance and the collision with the obstacle being detected. a main body; a drive wheel (151, 152) installed on the main body; a drive motor (153, 154) configured to rotate the drive wheel (151, 152); a travelling sensor configured to detect rotation of the drive wheel (151, 152); a first optical sensor configured to detect an obstacle located in a moving direction in which the main body moves; a cleaning tool configured to clean a floor; a second optical sensor configured to acquire an image of the floor and output a motion vector of the main body; the robot cleaner characterized by a collision sensor configured to detect a collision with the obstacle; and at least one processor electrically connected to the drive motor (153, 154), the travelling sensor, the first optical sensor, the second optical sensor and the collision sensor, wherein the at least one processor is configured to: determine a first moving distance moved by the main body based on an output of the travelling sensor; in response to detecting the obstacle, determine a second moving distance, by which the main body moves toward the obstacle after the detecting of the obstacle, based on the output from the second optical sensor; and control the cleaning tool to clean the floor in a vicinity of the obstacle in response to the second moving distance being greater than or equal to a threshold distance, which is based on a distance to the obstacle identified by the first optical sensor at a time when the obstacle is detected; and control the cleaning tool to clean the floor in the vicinity of the obstacle in response to the second moving distance being less than the threshold distance and the collision with the obstacle being detected. determine a first moving distance moved by the main body based on an output of the travelling sensor; in response to detecting the obstacle, determine a second moving distance, by which the main body moves toward the obstacle after the detecting of the obstacle, based on the output from the second optical sensor; and control the cleaning tool to clean the floor in a vicinity of the obstacle in response to the second moving distance being greater than or equal to a threshold distance, which is based on a distance to the obstacle identified by the first optical sensor at a time when the obstacle is detected; and control the cleaning tool to clean the floor in the vicinity of the obstacle in response to the second moving distance being less than the threshold distance and the collision with the obstacle being detected.