Flatness-based trajectory planning for 3D overhead cranes with friction compensation and collision avoidance