Real-Time Motion Planning of a Hydraulic Excavator using Trajectory Optimization and MPC