The present invention presents a method and system for an autonomous mower attached with a camera, wherein the control of the parameters of the camera and the control of the mower movement and grass detection are optimized holistically during operation. The present invention mitigates the camera sensing limits by adapting the movement speed of the mower. Furthermore, the camera control optimizes the visibility of grass by using the grass mask of a grass segmentation to calculate updated exposure, gain and aperture values only from grass pixels. The grass segmentation tracks changes in the grass color that are caused by illumination differences. Optionally, the system is equipped with a head light used to further improve the camera signal quality in conjunction with the control of the camera parameters and the movement speed of the mower.