Пример #1
0
def check_mag(conn):
    '''check mags'''
    magx = util.wait_field(conn.testmav, 'RAW_IMU', 'xmag')
    magy = util.wait_field(conn.testmav, 'RAW_IMU', 'ymag')
    magz = util.wait_field(conn.testmav, 'RAW_IMU', 'zmag')
    field = sqrt(magx**2 + magy**2 + magz**2)
    if field < 100 or field > 2000:
        util.failure("Bad magnetic field (%u, %u, %u, %.1f)" % (magx, magy, magz, field))
    logger.info("Magnetometer OK")
Пример #2
0
def check_mag(conn):
    '''check mags'''
    magx = util.wait_field(conn.testmav, 'RAW_IMU', 'xmag')
    magy = util.wait_field(conn.testmav, 'RAW_IMU', 'ymag')
    magz = util.wait_field(conn.testmav, 'RAW_IMU', 'zmag')
    field = sqrt(magx**2 + magy**2 + magz**2)
    if field < 100 or field > 2000:
        util.failure("Bad magnetic field (%u, %u, %u, %.1f)" %
                     (magx, magy, magz, field))
    logger.info("Magnetometer OK")
Пример #3
0
def check_power(conn):
    '''check power'''
    ref_vcc  = util.wait_field(conn.refmav, 'POWER_STATUS', 'Vcc')*0.001
    test_vcc = util.wait_field(conn.testmav, 'POWER_STATUS', 'Vcc')*0.001
    if abs(ref_vcc - test_vcc) > VOLTAGE_TOLERANCE:
        util.failure("Vcc error %.2f should be %.2f" % (test_vcc, ref_vcc))

    ref_vservo  = util.wait_field(conn.refmav, 'POWER_STATUS', 'Vservo')*0.001
    test_vservo = util.wait_field(conn.testmav, 'POWER_STATUS', 'Vservo')*0.001
    if abs(ref_vservo - test_vservo) > VOLTAGE_TOLERANCE:
        util.failure("Vservo error %.2f should be %.2f" % (test_vservo, ref_vservo))

    test_flags = util.wait_field(conn.testmav, 'POWER_STATUS', 'flags')
    pflags = mavutil.mavlink.MAV_POWER_STATUS_BRICK_VALID
    pflags |= mavutil.mavlink.MAV_POWER_STATUS_SERVO_VALID
    pflags |= mavutil.mavlink.MAV_POWER_STATUS_USB_CONNECTED
    if test_flags != pflags:
        util.failure("power flags error %u should be %u" % (test_flags, pflags))
        
    logger.info("Voltages OK")
Пример #4
0
def check_baro(conn):
    '''check baros'''
    ref_press = util.wait_field(conn.refmav, 'SCALED_PRESSURE', 'press_abs')
    if ref_press is None:
        util.failure("No reference pressure")
    press1 = util.wait_field(conn.testmav, 'SCALED_PRESSURE', 'press_abs')
    press2 = util.wait_field(conn.testmav, 'SCALED_PRESSURE2', 'press_abs')
    if press1 is None:
        util.failure("No pressure1 available")
    if press2 is None:
        util.failure("No pressure2 available")
    if abs(ref_press - press1) > PRESSURE_TOLERANCE:
        util.failure("Baro1 error pressure=%f should be %f" %
                     (press1, ref_press))
    if abs(ref_press - press2) > PRESSURE_TOLERANCE:
        util.failure("Baro2 error pressure=%f should be %f" %
                     (press2, ref_press))

    ref_temp = util.wait_field(conn.refmav, 'SCALED_PRESSURE',
                               'temperature') * 0.01
    temp1 = util.wait_field(conn.testmav, 'SCALED_PRESSURE',
                            'temperature') * 0.01
    temp2 = util.wait_field(conn.testmav, 'SCALED_PRESSURE2',
                            'temperature') * 0.01
    if abs(ref_temp - temp1) > TEMPERATURE_TOLERANCE:
        util.failure("Baro1 error temperature=%f should be %f" %
                     (temp1, ref_temp))
    if abs(ref_temp - temp2) > TEMPERATURE_TOLERANCE:
        util.failure("Baro2 error temperature=%f should be %f" %
                     (temp2, ref_temp))
    logger.info("Baros OK")
Пример #5
0
def check_power(conn):
    '''check power'''
    ref_vcc = util.wait_field(conn.refmav, 'POWER_STATUS', 'Vcc') * 0.001
    test_vcc = util.wait_field(conn.testmav, 'POWER_STATUS', 'Vcc') * 0.001
    if abs(ref_vcc - test_vcc) > VOLTAGE_TOLERANCE:
        util.failure("Vcc error %.2f should be %.2f" % (test_vcc, ref_vcc))

    ref_vservo = util.wait_field(conn.refmav, 'POWER_STATUS', 'Vservo') * 0.001
    test_vservo = util.wait_field(conn.testmav, 'POWER_STATUS',
                                  'Vservo') * 0.001
    if abs(ref_vservo - test_vservo) > VOLTAGE_TOLERANCE:
        util.failure("Vservo error %.2f should be %.2f" %
                     (test_vservo, ref_vservo))

    test_flags = util.wait_field(conn.testmav, 'POWER_STATUS', 'flags')
    pflags = mavutil.mavlink.MAV_POWER_STATUS_BRICK_VALID
    pflags |= mavutil.mavlink.MAV_POWER_STATUS_SERVO_VALID
    pflags |= mavutil.mavlink.MAV_POWER_STATUS_USB_CONNECTED
    if test_flags != pflags:
        util.failure("power flags error %u should be %u" %
                     (test_flags, pflags))

    logger.info("Voltages OK")
Пример #6
0
def check_baro(conn):
    '''check baros'''
    ref_press = util.wait_field(conn.refmav, 'SCALED_PRESSURE', 'press_abs')
    if ref_press is None:
        util.failure("No reference pressure")
    press1 = util.wait_field(conn.testmav, 'SCALED_PRESSURE', 'press_abs')
    press2 = util.wait_field(conn.testmav, 'SCALED_PRESSURE2', 'press_abs')
    if press1 is None:
        util.failure("No pressure1 available")
    if press2 is None:
        util.failure("No pressure2 available")
    if abs(ref_press - press1) > PRESSURE_TOLERANCE:
        util.failure("Baro1 error pressure=%f should be %f" % (press1, ref_press))
    if abs(ref_press - press2) > PRESSURE_TOLERANCE:
        util.failure("Baro2 error pressure=%f should be %f" % (press2, ref_press))

    ref_temp = util.wait_field(conn.refmav, 'SCALED_PRESSURE', 'temperature')*0.01
    temp1 = util.wait_field(conn.testmav, 'SCALED_PRESSURE', 'temperature')*0.01
    temp2 = util.wait_field(conn.testmav, 'SCALED_PRESSURE2', 'temperature')*0.01
    if abs(ref_temp - temp1) > TEMPERATURE_TOLERANCE:
        util.failure("Baro1 error temperature=%f should be %f" % (temp1, ref_temp))
    if abs(ref_temp - temp2) > TEMPERATURE_TOLERANCE:
        util.failure("Baro2 error temperature=%f should be %f" % (temp2, ref_temp))
    logger.info("Baros OK")