Method for performing a teat-related operation on a dairy animal with legs (4, 5-1, 5-2) and teats using a robot device, wherein the robot device comprises: - an animal-positioning area with a longitudinal direction and configured to accommodate the dairy animal, - a control unit, - a robot arm which is controllable by the control unit and has an end part for performing the teat-related operation on the teats, - a camera device which is operatively connected to the control unit, comprising a camera which is provided on the robot arm, and a processing device, and which is configured for - repeatedly determining an image of the environment in front of the camera, by means of the camera, - searching for and recognising one or more objects, such as legs (4, 5-1, 5-2), in the determined images, by means of the processing device, and - determining a position of the recognised objects with respect to the camera, and wherein the method comprises the steps of: - providing the robot arm with the camera in a position outside the animal-positioning area, - at least once performing and/or repeating: ∘ determining an image of the environment in front of the camera by means of the camera, ∘ searching for a leg in the determined image by means of the processing device, characterized in that ∘ if no leg (4, 5-1, 5-2) has been recognised in the image: displacing the robot arm outside the animal-positioning area in a direction with a component in said longitudinal direction, - until the camera device recognises a leg in the determined image, - determining the position of the determined leg with respect to the camera, viewed in said longitudinal direction, - displacing the robot arm in the direction of a predetermined positionary range with respect to the determined leg as long as the determined position is not in the predetermined positionary range with respect to the camera, - displacing at least the end part of the robot arm in a direction with a component at right angles to said longitudinal direction from outside the animal-positioning area to inside the animal-positioning area and as far as under the dairy animal, and - performing the teat-related operation. - an animal-positioning area with a longitudinal direction and configured to accommodate the dairy animal, - a control unit, - a robot arm which is controllable by the control unit and has an end part for performing the teat-related operation on the teats, - a camera device which is operatively connected to the control unit, comprising a camera which is provided on the robot arm, and a processing device, and which is configured for - repeatedly determining an image of the environment in front of the camera, by means of the camera, - searching for and recognising one or more objects, such as legs (4, 5-1, 5-2), in the determined images, by means of the processing device, and - determining a position of the recognised objects with respect to the camera, - repeatedly determining an image of the environment in front of the camera, by means of the camera, - searching for and recognising one or more objects, such as legs (4, 5-1, 5-2), in the determined images, by means of the processing device, and - determining a position of the recognised objects with respect to the camera, - providing the robot arm with the camera in a position outside the animal-positioning area, - at least once performing and/or repeating: ∘ determining an image of the environment in front of the camera by means of the camera, ∘ searching for a leg in the determined image by means of the processing device, characterized in that ∘ if no leg (4, 5-1, 5-2) has been recognised in the image: displacing the robot arm outside the animal-positioning area in a direction with a component in said longitudinal direction, ∘ determining an image of the environment in front of the camera by means of the camera, ∘ searching for a leg in the determined image by means of the processing device, characterized in that ∘ if no leg (4, 5-1, 5-2) has been recognised in the image: displacing the robot arm outside the animal-positioning area in a direction with a component in said longitudinal direction, - until the camera device recognises a leg in the determined image, - determining the position of the determined leg with respect to the camera, viewed in said longitudinal direction, - displacing the robot arm in the direction of a predetermined positionary range with respect to the determined leg as long as the determined position is not in the predetermined positionary range with respect to the camera, - displacing at least the end part of the robot arm in a direction with a component at right angles to said longitudinal direction from outside the animal-positioning area to inside the animal-positioning area and as far as under the dairy animal, and - performing the teat-related operation.