Statistics for Realtime Motion Planning for Manipulator Robots under Dynamic Environments: An Optimal Control Approach