code: def mavlink_packet(self, m):
          '''handle an incoming mavlink packet'''
          #do nothing if not caibrating
          if (self.calibrating == False):
              return
  
          if m.get_type() == 'RC_CHANNELS_RAW':
              for i in range(1,self.num_channels+1):
                  v = getattr(m, 'chan%u_raw' % i)
  
                  if self.get_cal_min(i) > v:
                      self.set_cal_min(i,v)
                      self.console.writeln("Calibrating: RC%u_MIN=%u" % (i, v))
                  if self.get_cal_max(i) < v:
                      self.set_cal_max(i,v)
                      self.console.writeln("Calibrating: RC%u_MAX=%u" % (i, v)f mavlink_packet(self, m):
          '''handle an incoming mavlink packet'''
          #do nothing if not caibrating
          if (self.calibrating == False):
              return
  
          if m.get_type() == 'RC_CHANNELS_RAW':
              for i in range(1,self.num_channels+1):
                  v = getattr(m, 'chan%u_raw' % i)
  
                  if self.get_cal_min(i) > v:
                      self.set_cal_min(i,v)
                      self.console.writeln("Calibrating: RC%u_MIN=%u" % (i, v))
                  if self.get_cal_max(i) < v:
                      self.set_cal_max(i,v)
                      self.console.writeln("Calibrating: RC%u_MAX=%u" % (i, v))
docs: handle an incoming mavlink packet