Nonlinear optimal control for the 4-DOF underactuated robotic tower crane