Controller for handling machines