The invention provides a system for connecting a teat cup to a teat, including a teat cup with an opening for receiving a teat, a robot arm for moving the teat cup, a teat cup positioning system with a 3D-sensor and a sensor device for measuring a control quantity, and for connecting the teat cup under the control of the 3D-camera and the control quantity. The sensor device includes at least two electrodes around the opening and a capacitive sensor configured to measure a quantity connected with the capacitance between the electrodes, in particular the capacitance between two electrodes. This system provides a reliable positioning with respect to a teat by, for example, maximization of the measured capacitance. The positioning system supports an optical 3D-sensor for the first, global positioning.