Exemplo n.º 1
0
def quick_scan(GCS_TIMESTAMP = 0, CONNECTION_TIMESTAMP = 0):
    # Parse configs file
    configs = parse_configs(sys.argv)

    # Create output file if not already created
    if autonomy.outfile is None:
        autonomy.outfile = new_output_file()
        tee = autonomy.Tee(sys.stdout, autonomy.outfile)
        sys.stdout = tee
        sys.stderr = tee

    # Start autonomy and CV threads
    autonomyToCV = QuickScanAutonomyToCV()
    autonomy_thread = Thread(target=quick_scan_autonomy,
                             args=(configs, autonomyToCV, GCS_TIMESTAMP, CONNECTION_TIMESTAMP))
    autonomy_thread.daemon = True
    autonomy_thread.start()

    cv_thread = Thread(target=quick_scan_cv, args=(configs, autonomyToCV, GCS_TIMESTAMP, CONNECTION_TIMESTAMP))
    cv_thread.daemon = True
    cv_thread.start()

    # Wait for the threads to finish
    autonomy_thread.join()
    cv_thread.join()

    # Close XBee device
    if autonomy.xbee:
        autonomyToCV.xbeeMutex.release()
        autonomy.xbee.close()
        autonomyToCV.xbeeMutex.release()
Exemplo n.º 2
0
def main():
    configs = parse_configs(sys.argv)

    # create output file for all console output
    autonomy.outfile = new_output_file()
    tee = autonomy.Tee(sys.stdout, autonomy.outfile)
    sys.stdout = tee
    sys.stderr = tee

    # no comms simulation; that wouldn't be useful as this program is supposed to interact w/ GCS
    global XBEE
    XBEE = setup_xbee()

    # send connection message
    connection_message = {
        "type": "connect",
        "time": 0,  # This field is currently not used
        "sid": configs['vehicle_id'],
        "tid": 0,  # The ID of GCS
        "id": 0,  # The ID of this message
        "jobsAvailable": ["quickScan", "detailedSearch", "guide"]
    }

    # wait to receive the connection ack and start message
    XBEE.add_data_received_callback(xbee_callback)

    send_till_ack(configs["mission_control_MAC"], connection_message, 0)

    if not autonomy.outfile.closed:
        autonomy.outfile.close()
Exemplo n.º 3
0
def detailed_search(vehicle = None, gcs_timestamp = 0, connection_timestamp = 0):
    # Parse configs file
    configs = parse_configs(sys.argv)

    # Create output file if not already created
    if autonomy.outfile is None:
        autonomy.outfile = new_output_file()
        tee = autonomy.Tee(sys.stdout, autonomy.outfile)
        sys.stdout = tee
        sys.stderr = tee

    # Start autonomy and CV threads
    autonomyToCV = DetailedSearchAutonomyToCV()

    autonomy_thread = Thread(target = detailed_search_autonomy,
                            args = (configs, autonomyToCV, gcs_timestamp, connection_timestamp, vehicle))
    autonomy_thread.daemon = True
    autonomy_thread.start()

    cv_thread = Thread(target = detailed_search_cv, args = (configs, autonomyToCV))
    cv_thread.daemon = True
    cv_thread.start()

    # Wait for the threads to finish
    autonomy_thread.join()
    cv_thread.join()

    # Close XBee device
    if autonomy.xbee:
        autonomy.xbee.close()