Sensing and action in the context of goal-directed behaviors