Simultaneous trajectory and camera planning