def update(self):
        '''Called at regular intervals to poll the mouse position to send continuous commands.'''
        if self.action_space == 'continuous': # mouse movement only used for continuous action space
            if self.world_state and self.world_state.is_mission_running:
                if self.mouse_event and self.prev_mouse_event:
                        rotation_speed = 0.1
                        turn_speed = ( self.mouse_event.x - self.prev_mouse_event.x ) * rotation_speed
                        pitch_speed = ( self.mouse_event.y - self.prev_mouse_event.y ) * rotation_speed
                        self.agent_host.sendCommand( 'turn '+str(turn_speed) )
                        self.agent_host.sendCommand( 'pitch '+str(pitch_speed) )
                if self.mouse_event:
                    if os.name == 'nt': # (moving the mouse cursor only seems to work on Windows)
                        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.mouse_event.x = old_div(self.canvas.winfo_width(),2)
                        self.mouse_event.y = old_div(self.canvas.winfo_height(),2)
                    self.prev_mouse_event = self.mouse_event
        if self.world_state.is_mission_running:
            self.root.after(50, self.update)