An agricultural machine for grouping windrows together or for windrowing products lying on the ground includes a main frame supporting a central gathering and windrowing device and two side gathering and windrowing devices connected to support arms that extend laterally during work. A processor makes calculations based on image points on the tool, imaged onto an imaging area. The holding member carries at least one holding device by means of which the tube can be picked up and which can be pivoted about an axis that is parallel to the longitudinal axis of the tube or that coincides therewith.