Exemplo n.º 1
0
def unit_test(mavproxy, mav):
    '''A scripted flight plan'''
    if ( 
        arducopter.calibrate_level(mavproxy, mav) and
        arducopter.arm_motors(mavproxy, mav) and  
        arducopter.takeoff(mavproxy,mav, alt_min=30, takeoff_throttle=1510)):
        return True
    return False
Exemplo n.º 2
0
def unit_test(mavproxy, mav):
    '''A scripted flight plan'''
    if (arducopter.calibrate_level(mavproxy, mav)
            and arducopter.arm_motors(mavproxy, mav) and arducopter.takeoff(
                mavproxy, mav, alt_min=80, takeoff_throttle=1510)
            and arducopter.hover(mavproxy, mav, hover_throttle=1300)
            and arducopter.fly_RTL(mavproxy, mav, side=80, timeout=80)):
        return True
    return False
Exemplo n.º 3
0
def unit_test(mavproxy, mav):
    '''A scripted flight plan'''
    if ( 
        arducopter.calibrate_level(mavproxy, mav) and
        arducopter.arm_motors(mavproxy, mav) and  
        arducopter.takeoff(mavproxy,mav, alt_min=30, takeoff_throttle=1510)  and
        arducopter.hover(mavproxy,mav, hover_throttle=1300) and
        arducopter.loiter(mavproxy, mav, holdtime=45, maxaltchange=20)): # 45 second loiter
        return True
    return False
Exemplo n.º 4
0
def unit_test(mavproxy, mav):
    '''A scripted flight plan'''
    if ( 
        arducopter.calibrate_level(mavproxy, mav) and
        arducopter.arm_motors(mavproxy, mav) and  
        arducopter.takeoff(mavproxy,mav, alt_min=80, takeoff_throttle=1510) and
        arducopter.hover(mavproxy,mav, hover_throttle=1300) and
        arducopter.fly_RTL(mavproxy, mav, side=80, timeout=80)):
        return True
    return False
Exemplo n.º 5
0
def unit_test(mavproxy, mav):
    '''A scripted flight plan'''
    if (arducopter.calibrate_level(mavproxy, mav)
            and arducopter.arm_motors(mavproxy, mav) and arducopter.takeoff(
                mavproxy, mav, alt_min=30, takeoff_throttle=1510)
            and arducopter.hover(mavproxy, mav, hover_throttle=1300)
            and arducopter.loiter(mavproxy, mav, holdtime=45,
                                  maxaltchange=20)):  # 45 second loiter
        return True
    return False
Exemplo n.º 6
0
def unit_test(mavproxy, mav):
    '''A scripted flight plan for testing AP_Limits'''
 
    time.sleep(5)   
    print "# Setting AP_Limits parameters"
    mavproxy.send('param set LIM_ENABLED 1\n')
    mavproxy.send('param set LIM_REQUIRED 0\n')
    mavproxy.send('param set LIM_DEBUG 1\n')
    mavproxy.send('param set LIM_SAFETIME 1\n')
    
    mavproxy.send('param set LIM_ALT_ON 1\n')
    mavproxy.send('param set LIM_ALT_REQ 0\n')
    mavproxy.send('param set LIM_ALT_MIN 0\n')
    mavproxy.send('param set LIM_ALT_MAX 50\n')
    
    mavproxy.send('param set LIM_FNC_ON 0\n')
    mavproxy.send('param set LIM_FNC_REQ 0\n')
    mavproxy.send('param set LIM_FNC_SMPL 1\n')
    mavproxy.send('param set LIM_FNC_RAD 50\n')
    
    time.sleep(5)
    print "# Listing AP_Limits parameters"
    mavproxy.send('param show LIM*\n')

    if ( 
        arducopter.calibrate_level(mavproxy, mav) and
        arducopter.arm_motors(mavproxy, mav) and  
        arducopter.takeoff(mavproxy,mav, alt_min=30, takeoff_throttle=1510) and
        arducopter.hover(mavproxy, mav, hover_throttle=1500)
    ):
    
    # Trigger for ALT_MAX
        climb_rate = 0
        previous_alt = 0
        timeout = 30
    
         # Do Not Exceed altitude
        alt_dne = 55
        tstart = time.time()
        mavproxy.send('rc 3 1550\n')
        while (time.time() < tstart + timeout):
            m = mav.recv_match(type='VFR_HUD', blocking=True)
            climb_rate = m.alt - previous_alt
            previous_alt = m.alt
            print("Trigger Altitude Limit: Cur:%u, climb_rate: %u" % (m.alt, climb_rate))
            if abs(climb_rate) > 0:
                tstart = time.time();
            if (mav.recv_match(condition='MAV.flightmode=="GUIDED"', blocking=False) != None):
                print "Triggered!"
                return True
            if m.alt >= alt_dne :
                print("Altitude Exceeded")
                return False
        return False
    return False
Exemplo n.º 7
0
def unit_test(mavproxy, mav):
    '''A scripted flight plan for testing AP_Limits'''

    time.sleep(5)
    print "# Setting AP_Limits parameters"
    mavproxy.send('param set LIM_ENABLED 1\n')
    mavproxy.send('param set LIM_REQUIRED 0\n')
    mavproxy.send('param set LIM_DEBUG 1\n')
    mavproxy.send('param set LIM_SAFETIME 1\n')

    mavproxy.send('param set LIM_ALT_ON 1\n')
    mavproxy.send('param set LIM_ALT_REQ 0\n')
    mavproxy.send('param set LIM_ALT_MIN 0\n')
    mavproxy.send('param set LIM_ALT_MAX 50\n')

    mavproxy.send('param set LIM_FNC_ON 0\n')
    mavproxy.send('param set LIM_FNC_REQ 0\n')
    mavproxy.send('param set LIM_FNC_SMPL 1\n')
    mavproxy.send('param set LIM_FNC_RAD 50\n')

    time.sleep(5)
    print "# Listing AP_Limits parameters"
    mavproxy.send('param show LIM*\n')

    if (arducopter.calibrate_level(mavproxy, mav)
            and arducopter.arm_motors(mavproxy, mav) and arducopter.takeoff(
                mavproxy, mav, alt_min=30, takeoff_throttle=1510)
            and arducopter.hover(mavproxy, mav, hover_throttle=1500)):

        # Trigger for ALT_MAX
        climb_rate = 0
        previous_alt = 0
        timeout = 30

        # Do Not Exceed altitude
        alt_dne = 55
        tstart = time.time()
        mavproxy.send('rc 3 1550\n')
        while (time.time() < tstart + timeout):
            m = mav.recv_match(type='VFR_HUD', blocking=True)
            climb_rate = m.alt - previous_alt
            previous_alt = m.alt
            print("Trigger Altitude Limit: Cur:%u, climb_rate: %u" %
                  (m.alt, climb_rate))
            if abs(climb_rate) > 0:
                tstart = time.time()
            if (mav.recv_match(condition='MAV.flightmode=="GUIDED"',
                               blocking=False) != None):
                print "Triggered!"
                return True
            if m.alt >= alt_dne:
                print("Altitude Exceeded")
                return False
        return False
    return False
Exemplo n.º 8
0
    if not arducopter.calibrate_level(mavproxy, mav):
      error('Failed to calibrate level.')
      failed = True

    print 'Arming motors...'
    if not arducopter.arm_motors(mavproxy, mav):
      error('Failed to arm motors.')
      failed = True

    if (mission_path and
        arducopter.load_mission_from_file(mavproxy, mav, mission_path)):
        error('Failed to load mission %s' % (mission_path,))
        failed = True

    print 'Taking off.'
    if not arducopter.takeoff(mavproxy, mav, 10):
      error('Failed to takeoff.')

    if mission_path:
      print 'Beginning mission in...'
      for i in range(3, 0, -1):
        print i
        time.sleep(1)
      print 'Flying mission.'
      if not arducopter.fly_mission(mavproxy, mav, height_accuracy=0.5,
                                    target_altitude=10):
        error("fly_mission failed")
        failed = True
      else:
        print 'MISSION COMPLETE.'