Sets a mission running.
        
        Parameters:
        mission_spec : MissionSpec instance, specifying the mission.
        mission_record_spec : MissionRecordSpec instance, specifying what should be recorded.
        role : int, the index of the role this human agent is to play. Zero based.

def runMission( self, mission_spec, mission_record_spec, role = 0 ):
        '''Sets a mission running.
        
        Parameters:
        mission_spec : MissionSpec instance, specifying the mission.
        mission_record_spec : MissionRecordSpec instance, specifying what should be recorded.
        role : int, the index of the role this human agent is to play. Zero based.
        '''
        
        self.world_state = None
        total_reward = 0
        
        # decide on the action space
        command_handlers = mission_spec.getListOfCommandHandlers(role)
        if 'ContinuousMovement' in command_handlers and 'DiscreteMovement' in command_handlers:
            print('ERROR: Ambiguous action space in supplied mission: both continuous and discrete command handlers present.')
            exit(1)
        elif 'ContinuousMovement' in command_handlers:
            self.action_space = 'continuous'
        elif 'DiscreteMovement' in command_handlers:
            self.action_space = 'discrete'
        else:
            print('ERROR: Unknown action space in supplied mission: neither continuous or discrete command handlers present.')
            exit(1)

        self.createGUI()
        
        if mission_spec.isVideoRequested(0):
            self.canvas.config( width=mission_spec.getVideoWidth(0), height=mission_spec.getVideoHeight(0) )

        # show the mission summary
        start_time = time.time()
        while time.time() - start_time < 4:
            canvas_id = self.canvas.create_rectangle(100, 100, 540, 200, fill="white", outline="red", width="5")
            self.canvas.create_text(320, 120, text=mission_spec.getSummary(), font=('Helvetica', '16'))
            self.canvas.create_text(320, 150, text=str(3 - int(time.time() - start_time)), font=('Helvetica', '16'), fill="red")
            self.root.update()
            time.sleep(0.2)
                
        try:
            self.agent_host.startMission( mission_spec, mission_record_spec )
        except RuntimeError as e:
            tkinter.messagebox.showerror("Error","Error starting mission: "+str(e))
            return

        print("Waiting for the mission to start", end=' ')
        self.world_state = self.agent_host.peekWorldState()
        while not self.world_state.has_mission_begun:
            print(".", end="")
            time.sleep(0.1)
            self.world_state = self.agent_host.peekWorldState()
            for error in self.world_state.errors:
                print("Error:",error.text)
        print()
        if self.action_space == 'continuous':
            self.canvas.config(cursor='none') # hide the mouse cursor while over the canvas
            self.canvas.event_generate('<Motion>', warp=True, x=old_div(self.canvas.winfo_width(),2), y=old_div(self.canvas.winfo_height(),2)) # put cursor at center
            self.root.after(50, self.update)
        self.canvas.focus_set()

        while self.world_state.is_mission_running:
            self.world_state = self.agent_host.getWorldState()
            if self.world_state.number_of_observations_since_last_state > 0:
                self.observation.config(text = self.world_state.observations[0].text )
            if mission_spec.isVideoRequested(0) and self.world_state.number_of_video_frames_since_last_state > 0:
                frame = self.world_state.video_frames[-1]
                image = Image.frombytes('RGB', (frame.width,frame.height), bytes(frame.pixels) )
                photo = ImageTk.PhotoImage(image)
                self.canvas.delete("all")
                self.canvas.create_image(old_div(frame.width,2), old_div(frame.height,2), image=photo)
            self.canvas.create_line( old_div(self.canvas.winfo_width(),2)-5, old_div(self.canvas.winfo_height(),2),   old_div(self.canvas.winfo_width(),2)+6, old_div(self.canvas.winfo_height(),2),   fill='white' )
            self.canvas.create_line( old_div(self.canvas.winfo_width(),2),   old_div(self.canvas.winfo_height(),2)-5, old_div(self.canvas.winfo_width(),2),   old_div(self.canvas.winfo_height(),2)+6, fill='white' )
            # parse reward
            for reward in self.world_state.rewards:
                total_reward += reward.getValue()
            self.reward.config(text = str(total_reward) )
            self.root.update()
            time.sleep(0.01)
        if self.action_space == 'continuous':
            self.canvas.config(cursor='arrow') # restore the mouse cursor
        print('Mission stopped')
        if not self.agent_host.receivedArgument("test"):
            tkinter.messagebox.showinfo("Mission ended","Mission has ended. Total reward: " + str(total_reward) )
        self.root_frame.destroy()