Intelligent loading machine for trucks