Optimal trajectory planning for industrial manipulators