handle an incoming mavlink packet

def mavlink_packet(self, msg):
        '''handle an incoming mavlink packet'''
        msgType = msg.get_type()
        master = self.master       
        if msgType == 'HEARTBEAT':
            # Update state and mode information
            if type(master.motors_armed()) == type(True):
                self.armed = master.motors_armed()
                self.mode = master.flightmode
                # Send Flight State information down pipe
                self.msgList.append(FlightState(self.mode,self.armed))
        elif msgType == 'ATTITUDE':
            # Send attitude information down pipe
            self.msgList.append(Attitude(msg))
        elif msgType == 'VFR_HUD':
            # Send HUD information down pipe
            self.msgList.append(VFR_HUD(msg))
        elif msgType == 'GLOBAL_POSITION_INT':
            # Send altitude information down pipe
            self.msgList.append(Global_Position_INT(msg,time.time()))
        elif msgType == 'SYS_STATUS':
            # Mode and Arm State
            self.msgList.append(BatteryInfo(msg))
        elif msgType in ['WAYPOINT_CURRENT', 'MISSION_CURRENT']:
            # Waypoints
            self.currentWP = msg.seq
            self.finalWP = self.module('wp').wploader.count()
            self.msgList.append(WaypointInfo(self.currentWP,self.finalWP,self.currentDist,self.nextWPTime,self.wpBearing))
        elif msgType == 'NAV_CONTROLLER_OUTPUT':
            self.currentDist = msg.wp_dist
            self.speed = master.field('VFR_HUD', 'airspeed', 30)
            if self.speed > 1:
                self.nextWPTime = self.currentDist / self.speed
            else:
                self.nextWPTime = '-'
            self.wpBearing = msg.target_bearing
            self.msgList.append(WaypointInfo(self.currentWP,self.finalWP,self.currentDist,self.nextWPTime,self.wpBearing))