Modeling Perceptual and Motor Behavior in a Cognitive Context