Autonomous task planning and situation awareness in robotic surgery