Provided is a
pallet sensing device or the like which can accurately extract a straight line corresponding to the front surface of a
pallet without moving a two-dimensional distance measuring device in the vertical direction, and can sense the position and posture of the
pallet in a short time. The pallet sensing device is provided with: a point group acquisition unit configured so as to acquire point group data in which point groups measured by the two-dimensional
distance measurement device are represented on a
depth map; a straight line detection unit configured to detect a straight line corresponding to the front surface of the pallet on the basis of a point group in a region deduced to include the front surface of the pallet in the point group data; a
line segment detection unit configured to detect a
line segment indicating a front surface of the pallet on the basis of the straight line; and a position and posture acquisition unit configured to acquire the position and posture of the pallet on the basis of the
line segment. The straight line detection unit acquires one or more straight line candidates as candidates for straight lines corresponding to the front of the pallet, and assigns, to each of the one or more straight line candidates, a
score having a
lower priority than a constant of other point groups when selected to a point group on the front side that is a predetermined distance or more from the straight line candidate. A straight line corresponding to the front of the pallet is selected from among the one or more straight line candidates on the basis of a
score accumulation value obtained by accumulating scores for the point groups in the region deduced to include the front of the pallet.