Beispiel #1
0
def test_camera_thumbs(mpstate, image_file):
    '''Send some thumbnails to the view via the camera_air module'''
    loadedModuleAir = camera_air.init(mpstate)
    parms = "/data/ChameleonArecort/params.json"
    loadedModuleAir.cmd_camera(["set", "camparms", parms])
    loadedModuleAir.cmd_camera(["set", "imagefile", image_file])
    loadedModuleAir.cmd_camera(["set", "minscore", "0"])
    loadedModuleAir.cmd_camera(["set", "gcs_address", "127.0.0.1:14000:15000:45, 127.0.0.1:14500:15500:60000"])

    loadedModuleGround = camera_ground.init(mpstate)
    loadedModuleGround.cmd_camera(["set", "camparms", parms])
    loadedModuleGround.cmd_camera(["set", "air_address", "127.0.0.1:15000:14000:45, 127.0.0.1:15500:14500:60000"])
    loadedModuleGround.cmd_camera(["view"])

    #start the image stream and modules
    capture_thread = sim_camera()
    time.sleep(0.05)
    loadedModuleAir.cmd_camera(["start"])
    time.sleep(2.0)

    #and request a fullsize image
    filename = os.path.join(os.getcwd(), 'tests', 'testdata', 'raw2016111223465160Z.png')
    frame_time = cuav_util.parse_frame_time(filename)
    loadedModuleGround.mosaic.image_requests[frame_time] = 'fetchImageFull'
    time.sleep(2.0)

    loadedModuleAir.unload()
    loadedModuleGround.unload()
    capture_thread.join(1.0)

    #and do the asserts
    assert loadedModuleAir.region_count > 0
    assert loadedModuleGround.region_count > 0
    assert loadedModuleGround.thumb_count > 0
    assert loadedModuleGround.image_count > 0
Beispiel #2
0
def test_module_settings(mpstate):
    '''try changing module settings via MAVProxy CLI'''
    loadedModule = camera_ground.init(mpstate)
    parms = "/data/ChameleonArecort/params.json"
    loadedModule.cmd_camera(["set", "camparms", parms])
    assert loadedModule.camera_settings.camparms == parms

    loadedModule.cmd_camera(["set", "air_address", "127.0.0.1:15550:14550:45, 127.0.0.1:4500:1234:6000"])
    assert loadedModule.camera_settings.air_address == "127.0.0.1:15550:14550:45, 127.0.0.1:4500:1234:6000"

    loadedModule.unload()
Beispiel #3
0
def test_module_settings(mpstate):
    '''try changing module settings via MAVProxy CLI'''
    loadedModule = camera_ground.init(mpstate)
    parms = "/data/ChameleonArecort/params.json"
    loadedModule.cmd_camera(["set", "camparms", parms])
    assert loadedModule.camera_settings.camparms == parms

    loadedModule.cmd_camera([
        "set", "air_address",
        "127.0.0.1:15550:14550:45, 127.0.0.1:4500:1234:6000"
    ])
    assert loadedModule.camera_settings.air_address == "127.0.0.1:15550:14550:45, 127.0.0.1:4500:1234:6000"

    loadedModule.unload()
Beispiel #4
0
def test_camera_commands(mpstate):
    '''Initialise the camera view frame and boundary'''
    loadedModule = camera_ground.init(mpstate)

    parms = "/data/ChameleonArecort/params.json"
    bnd = str(os.path.join(os.getcwd(), 'tests', 'testdata', 'OBC_boundary.txt'))
    loadedModule.cmd_camera(["set", "camparms", parms])

    loadedModule.cmd_camera(["view"])

    time.sleep(1.0)
    assert loadedModule.view_thread is not None

    loadedModule.cmd_camera(["boundary", bnd])

    loadedModule.unload()
    time.sleep(1.0)

    assert loadedModule.boundary_polygon is not None
Beispiel #5
0
def test_camera_thumbs(mpstate, image_file):
    '''Send some thumbnails to the view via the camera_air module'''
    loadedModuleAir = camera_air.init(mpstate)
    parms = "/data/ChameleonArecort/params.json"
    loadedModuleAir.cmd_camera(["set", "camparms", parms])
    loadedModuleAir.cmd_camera(["set", "imagefile", image_file])
    loadedModuleAir.cmd_camera(["set", "minscore", "0"])
    loadedModuleAir.cmd_camera([
        "set", "gcs_address",
        "127.0.0.1:14000:15000:45, 127.0.0.1:14500:15500:60000"
    ])

    loadedModuleGround = camera_ground.init(mpstate)
    loadedModuleGround.cmd_camera(["set", "camparms", parms])
    loadedModuleGround.cmd_camera([
        "set", "air_address",
        "127.0.0.1:15000:14000:45, 127.0.0.1:15500:14500:60000"
    ])
    loadedModuleGround.cmd_camera(["view"])

    #start the image stream and modules
    capture_thread = sim_camera()
    time.sleep(0.05)
    loadedModuleAir.cmd_camera(["start"])
    time.sleep(2.0)

    #and request a fullsize image
    filename = os.path.join(os.getcwd(), 'tests', 'testdata',
                            'raw2016111223465160Z.png')
    frame_time = cuav_util.parse_frame_time(filename)
    loadedModuleGround.mosaic.image_requests[frame_time] = 'fetchImageFull'
    time.sleep(2.0)

    loadedModuleAir.unload()
    loadedModuleGround.unload()
    capture_thread.join(1.0)

    #and do the asserts
    assert loadedModuleAir.region_count > 0
    assert loadedModuleGround.region_count > 0
    assert loadedModuleGround.thumb_count > 0
    assert loadedModuleGround.image_count > 0
Beispiel #6
0
def test_camera_commands(mpstate):
    '''Initialise the camera view frame and boundary'''
    loadedModule = camera_ground.init(mpstate)

    parms = "/data/ChameleonArecort/params.json"
    bnd = str(
        os.path.join(os.getcwd(), 'tests', 'testdata', 'OBC_boundary.txt'))
    loadedModule.cmd_camera(["set", "camparms", parms])

    loadedModule.cmd_camera(["view"])

    time.sleep(1.0)
    assert loadedModule.view_thread is not None

    loadedModule.cmd_camera(["boundary", bnd])

    loadedModule.unload()
    time.sleep(1.0)

    assert loadedModule.boundary_polygon is not None
Beispiel #7
0
def test_toggle_JoeZone(mpstate):
    '''toggle the Joe zone on the map'''
    loadedModule = cuav_check.init(mpstate)

    loadedModule.toggle_JoeZone()
    assert loadedModule.target == None

    loadedModule.mpstate.public_modules['camera_ground'] = cuav_camera_ground.init(mpstate)
    loadedModule.mpstate.public_modules['camera_ground'].camera_settings.target_radius = 0
    loadedModule.mpstate.map = mock.Mock()
    loadedModule.toggle_JoeZone()
    assert loadedModule.target == None

    loadedModule.module('camera_ground').return_value = True
    loadedModule.module('camera_ground').camera_settings.target_radius = 100
    loadedModule.module('camera_ground').camera_settings.target_latitude = -34
    loadedModule.module('camera_ground').camera_settings.target_longitude = -45
    loadedModule.toggle_JoeZone()
    assert loadedModule.target == (-34, -45, 100)

    loadedModule.unload()
Beispiel #8
0
def test_toggle_JoeZone(mpstate):
    '''toggle the Joe zone on the map'''
    loadedModule = cuav_check.init(mpstate)
    loadedModule.mpstate.public_modules['link'] = mock.Mock()

    loadedModule.toggle_JoeZone()
    assert loadedModule.target == None

    loadedModule.mpstate.public_modules[
        'camera_ground'] = cuav_camera_ground.init(mpstate)
    loadedModule.mpstate.public_modules[
        'camera_ground'].camera_settings.target_radius = 0
    loadedModule.mpstate.map = mock.Mock()
    loadedModule.toggle_JoeZone()
    assert loadedModule.target == None

    loadedModule.module('camera_ground').return_value = True
    loadedModule.module('camera_ground').camera_settings.target_radius = 100
    loadedModule.module('camera_ground').camera_settings.target_latitude = -34
    loadedModule.module('camera_ground').camera_settings.target_longitude = -45
    loadedModule.toggle_JoeZone()
    assert loadedModule.target == (-34, -45, 100)

    loadedModule.unload()
Beispiel #9
0
def test_load_module(mpstate):
    '''Just initialise the module'''
    loadedModule = camera_ground.init(mpstate)
    loadedModule.unload()
Beispiel #10
0
def test_load_module(mpstate):
    '''Just initialise the module'''
    loadedModule = camera_ground.init(mpstate)
    loadedModule.unload()