Optimization of the energy consumption of industrial robots for automatic code generation