PROBLEM TO BE SOLVED: To provide a range-finding device that can highly accurately measure a distance to an object regardless of presence or absence of a dynamic change in the object.SOLUTION: A distance sensor comprises: a light projection system; an image sensor that receive a light projected from the light projection system and reflected upon an object to photoelectrically convert the light, and sorts an electric signal of the photoelectrically converted light into a plurality of phase signals; a buffer memory for storing information including the plurality of phase signals and values based on the plurality of phase signals; a dynamic change presence or absence determination unit that determines presence or absence of a dynamic change in the object on the basis of information on a current frame and at least one past frame; and a distance computation unit that calculates a distance to the object. The distance computation unit is configured to, when it is determined that there is no dynamic change therein, subject information on at least two frames of a plurality of frames including the current frame and the at least one past frame to a moving average; acquire a distance from a result of the moving average; when it is determined that there is the dynamic change therein, subject information on a plurality of past frames to the moving average; and acquire the distance from the result of the moving average.SELECTED DRAWING: Figure 12
展开▼