There is disclosed a system (1) for controlling an automatic milking system (2), configured for automatically receiving, identifying and selectively milking a lactating animal in accordance with a set of milking parameters associated with said animal. The system comprises a thermal imaging device (3), configured for generating at least one current thermal image of at least a portion of an udder of said animal, a storage device (4), configured for storing at least one reference thermal image of said udder, and a processing device (7), configured for comparing at least one current value derived from said at least one current thermal image and/or at least one current thermal image with at least one reference value derived from said at least one reference thermal image and/or at least one reference thermal image. The processing device is arranged to selectively provide a status indication of said animal in response to a result of said comparison.