Interactions between humans and service robots are more natural when emotions can be synthesized in those robots. Cognitive appraisal theory of emotions provides a theoretical basis for designing artificial emotion generation systems for robots. Computational algorithms to implement the cognitive appraisal theory were proposed in this research. The algorithms were based on a probabilistic description about the world. The proposed model was applied to a sample of interactive tasks, and the robot's emotions during the task execution can lead to a more positive human-robot interaction experience.