Ejemplo n.º 1
0
def load_file(ulog_file_path, reload=True):
    """ Main function to load a Ulg file and create a Flight Object
    return : Flight object ( and saved or not  in a pkl file) 
    """
    if reload_file:
        # print("Reading Ulog file : " + str(ulog_file_name))

        mflight = Flight()

        mflight.add_data_file(ulog_file_path, Device.PIXRACER, Position.PILOT)
        mflight.add_info("Tulipe Glider", "Razor4", None, "Paul", 94.2,
                         "Nice Place")
        mflight.add_general_section()

        logger.info("Writing : " + name_saved_file)
        with open(name_saved_file, "wb") as f:
            pickle.dump(mflight, f)

    else:
        logger.info("Reading : " + name_saved_file)
        with open(name_saved_file, "rb") as f:
            mflight = pickle.load(f)

    # Print Data for debug.
    logger.debug(mflight)
    df_data = mflight.data[0].list_available_data()
    logger.debug(df_data)
    # df_data.loc[df_data['parent']=='vehicle_local_position']

    mdf = mflight.get_df_by_position(Position.PILOT)[0]
    logger.debug(mdf)
Ejemplo n.º 2
0
    mflight.add_info("Tulipe Glider", "Razor4", None, "Paul", 94.2,
                     "Nice Place")

    logger.info("Writing : " + name_saved_file)

    with open(name_saved_file, "wb") as f:
        pickle.dump(mflight, f)

else:
    logger.info("Reading : " + name_saved_file)
    with open(name_saved_file, "rb") as f:
        mflight = pickle.load(f)

# Print the input Dataframe.
print(mflight)

#%%
df_data = mflight.data[0].list_avalable_data()
print(df_data)
# df_data.loc[df_data['parent']=='vehicle_local_position']

#%% Plot
mdf = mflight.get_df_by_position(Position.PILOT)[0]
print(mdf)

logger.info(" --- END ----")

print("END")

#%%