<commit_before>import multiprocessing
import SUASSystem
import dronekit
import time
import numpy
from .suas_logging import *
from .settings import GCSSettings
from time import sleep
from .converter_functions import *

gcs_logger_name = multiprocessing.current_process().name

def gcs_process(sda_status, img_proc_status, interop_client_array, targets_to_submit, user_force_waypoint_update):
    # Setup logging information
    logger_queue = multiprocessing.Queue(-1)
    logger_listener_process = multiprocessing.Process(target=listener_process, args=(
        logger_queue,
        logger_listener_configurer
    ))
    logger_listener_process.start()
    logger_worker_configurer(logger_queue)

    manager = multiprocessing.Manager()
    vehicle_state_data = manager.list()
    mission_information_data = manager.list()
    sda_avoid_coords = manager.list()
    UAV_status = manager.Value('s', "AUTO")
    location_log = manager.list()
    vehicle = connect_to_vehicle()
    waypoints = download_waypoints(vehicle)

    recieve_image_filenames, send_image_filenames = multiprocessing.Pipe(False)

    if len(interop_client_array) != 0:
        mission_information_data.append(get_mission_json(interop_client_array[0].get_active_mission(), interop_client_array[0].get_obstacles()))
    else:
        print("[Error] : The GCS process is unable to load mission data from the Interoperability server")
        mission_information_data.append({})
    vehicle_state_data.append(SUASSystem.get_vehicle_state(vehicle, GCSSettings.MSL_ALT))
    competition_viewer_process = initialize_competition_viewer_process(vehicle_state_data, mission_information_data)
    sd_card_process = load_sd_card(send_image_filenames, location_log, interop_client_array)
    img_proc_process = initialize_image_processing_process(logger_queue, location_log, targets_to_submit, interop_client_array)
    autonomous_img_proc_process = initialize_autonomous_image_processing_process(logger_queue, location_log, interop_client_array, img_proc_status, recieve_image_filenames)
    sda_process = initialize_sda_process(logger_queue, sda_status, UAV_status, waypoints, sda_avoid_coords, vehicle_state_data, mission_information_data)
    log(gcs_logger_name, "Completed instantiation of all child processes")
    while True:
        current_location = get_location(vehicle)
        current_location_json = {
            "current_location": current_location,
            "epoch_time": time.time()
        }
        location_log.append(current_location_json)

        vehicle_state_data[0] = SUASSystem.get_vehicle_state(vehicle, GCSSettings.MSL_ALT)

        if len(interop_client_array) != 0:
            interop_client_array[0].post_telemetry(current_location, vehicle_state_data[0].get_direction())
            mission_information_data[0] = get_mission_json(interop_client_array[0].get_active_mission(), interop_client_array[0].get_obstacles())

        if (vehicle.location.global_relative_frame.alt * 3.28084) > GCSSettings.SDA_MIN_ALT and sda_status.value.lower() == "connected":
            if (UAV_status.value == "GUIDED"):
                sda_avoid_feet_height = Location(sda_avoid_coords[0].get_lat(), sda_avoid_coords[0].get_lon(), sda_avoid_coords[0].get_alt()*3.28084)
                log("root", "Avoiding obstacles...")
                vehicle.mode = dronekit.VehicleMode("GUIDED")
                vehicle.simple_goto(sda_avoid_coords[0].as_global_relative_frame())
            if UAV_status.value == 'AUTO' and vehicle.mode.name != "AUTO":
                vehicle.mode = dronekit.VehicleMode("AUTO")
<commit_msg>Remove SDA from GCS process<commit_after>import multiprocessing
import SUASSystem
import dronekit
import time
import numpy
from .suas_logging import *
from .settings import GCSSettings
from time import sleep
from .converter_functions import *

gcs_logger_name = multiprocessing.current_process().name

def gcs_process(sda_status, img_proc_status, interop_client_array, targets_to_submit, user_force_waypoint_update):
    # Setup logging information
    logger_queue = multiprocessing.Queue(-1)
    logger_listener_process = multiprocessing.Process(target=listener_process, args=(
        logger_queue,
        logger_listener_configurer
    ))
    logger_listener_process.start()
    logger_worker_configurer(logger_queue)

    manager = multiprocessing.Manager()
    vehicle_state_data = manager.list()
    mission_information_data = manager.list()
    location_log = manager.list()
    vehicle = connect_to_vehicle()
    # SDA
    #waypoints = download_waypoints(vehicle)
    #sda_avoid_coords = manager.list()
    #UAV_status = manager.Value('s', "AUTO")

    recieve_image_filenames, send_image_filenames = multiprocessing.Pipe(False)

    if len(interop_client_array) != 0:
        mission_information_data.append(get_mission_json(interop_client_array[0].get_active_mission(), interop_client_array[0].get_obstacles()))
    else:
        print("[Error] : The GCS process is unable to load mission data from the Interoperability server")
        mission_information_data.append({})

    vehicle_state_data.append(SUASSystem.get_vehicle_state(vehicle, GCSSettings.MSL_ALT))
    competition_viewer_process = initialize_competition_viewer_process(vehicle_state_data, mission_information_data)
    sd_card_process = load_sd_card(send_image_filenames, location_log, interop_client_array)
    img_proc_process = initialize_image_processing_process(logger_queue, location_log, targets_to_submit, interop_client_array)
    autonomous_img_proc_process = initialize_autonomous_image_processing_process(logger_queue, location_log, interop_client_array, img_proc_status, recieve_image_filenames)
    # SDA
    #sda_process = initialize_sda_process(logger_queue, sda_status, UAV_status, waypoints, sda_avoid_coords, vehicle_state_data, mission_information_data)
    log(gcs_logger_name, "Completed instantiation of all child processes")

    while True:
        current_location = get_location(vehicle)
        current_location_json = {
            "current_location": current_location,
            "epoch_time": time.time()
        }
        location_log.append(current_location_json)

        vehicle_state_data[0] = SUASSystem.get_vehicle_state(vehicle, GCSSettings.MSL_ALT)

        if len(interop_client_array) != 0:
            interop_client_array[0].post_telemetry(current_location, vehicle_state_data[0].get_direction())
            mission_information_data[0] = get_mission_json(interop_client_array[0].get_active_mission(), interop_client_array[0].get_obstacles())

        # NOTE: The following commented code enables autonomous SDA. It has been left in this codebase to make it easier for future teams to
        #   understand the code. Please do not remove from codebase 2017/2018
        #if (vehicle.location.global_relative_frame.alt * 3.28084) > GCSSettings.SDA_MIN_ALT and sda_status.value.lower() == "connected":
        #    if (UAV_status.value == "GUIDED"):
        #        sda_avoid_feet_height = Location(sda_avoid_coords[0].get_lat(), sda_avoid_coords[0].get_lon(), sda_avoid_coords[0].get_alt()*3.28084)
        #        log("root", "Avoiding obstacles...")
        #        vehicle.mode = dronekit.VehicleMode("GUIDED")
        #        vehicle.simple_goto(sda_avoid_coords[0].as_global_relative_frame())
        #    if UAV_status.value == 'AUTO' and vehicle.mode.name != "AUTO":
        #        vehicle.mode = dronekit.VehicleMode("AUTO")
{'fraction_non_alphanumeric': 0.08610515021459228, 'fraction_numerical': 0.008315450643776824, 'mean_word_length': 4.683689024390244, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4304468', 'n_tokens_mistral': 2368, 'n_tokens_neox': 2288, 'n_words': 377}