Planning and action in real time