A system for determining the distance of an object with respect to a reference position , said system comprising: an optical sensor which is arranged at the reference position and which has a predefined field of view , an electronic processing unit which is configured: to receive an image acquired by the optical sensor , to receive predetermined identification features and predetermined geometric data of the object , to detect the object in the field of view of the optical sensor based on the predetermined identification features , to identify at least two key positions of the object in the image , to determine the distance of the key positions in the image , and to determine the distance of the object with respect to the reference position based on the distance of the key positions in the image and based on the predetermined geometric data of the object , characterized in that the electronic processing unit is additionally configured to output an error message if the object cannot be detected in the field of view of the optical sensor based on the predetermined identification features and/or if the key positions of the object cannot be identified in the image , and in that the electronic processing unit is additionally configured, if an object is indeed recognizable in the image , but the object and/or the key positions of the object is/are not clearly identifiable in the image , to assign a predefined distance to two selected points in the image , said predefined distance replacing a distance of predefined object positions, which is included in the geometric data for an assignment to the distance of the key positions , when determining the distance between the object and the reference position . an optical sensor which is arranged at the reference position and which has a predefined field of view , an electronic processing unit which is configured: to receive an image acquired by the optical sensor , to receive predetermined identification features and predetermined geometric data of the object , to detect the object in the field of view of the optical sensor based on the predetermined identification features , to identify at least two key positions of the object in the image , to determine the distance of the key positions in the image , and to determine the distance of the object with respect to the reference position based on the distance of the key positions in the image and based on the predetermined geometric data of the object , to receive an image acquired by the optical sensor , to receive predetermined identification features and predetermined geometric data of the object , to detect the object in the field of view of the optical sensor based on the predetermined identification features , to identify at least two key positions of the object in the image , to determine the distance of the key positions in the image , and to determine the distance of the object with respect to the reference position based on the distance of the key positions in the image and based on the predetermined geometric data of the object , the electronic processing unit is additionally configured to output an error message if the object cannot be detected in the field of view of the optical sensor based on the predetermined identification features and/or if the key positions of the object cannot be identified in the image , and in that the electronic processing unit is additionally configured, if an object is indeed recognizable in the image , but the object and/or the key positions of the object is/are not clearly identifiable in the image , to assign a predefined distance to two selected points in the image , said predefined distance replacing a distance of predefined object positions, which is included in the geometric data for an assignment to the distance of the key positions , when determining the distance between the object and the reference position . <EOS>