The robot controller includes an information collecting section collecting state information showing, in real time, a state of an environment of the robot; a program selecting section selecting a first executable program satisfying a task starting condition, from operation programs ready to be executed for workpieces, based on the state information; a processing section processing, for execution, the first executable program; and a program-completion judging section judging whether the processing section has completed a processing of the first executable program. The program selecting section selects, based on the state information, a second executable program satisfying the task starting condition, from the operation programs ready to be executed, so as to satisfy a judgment of the program-completion judging section.