Optimal Control of Hydraulically Actuated Flexible Multibody Systems