Exemplo n.º 1
0
def main(scenario_name, ic_name='std_ic', save=False):
    """Run the offline path planner.

    This function import the scenario named 'scenario_name' from the folder /cfg/ and takes the initial conditions
    named 'ic_name' from the yaml file /cfg/initial_conditions.yaml.

    After importing, it solves it and saves it (if save flag is true) in a .pickle file in the /example/ folder.

    Args:
        scenario_name (str): The name of the scenario which should be solved.
        ic_name (str): The initial condition name which should be used.
        save (bool): Boolean flag to save and store the result.

    Return:
        tot_dV (float): Total amount of deltaV consumed in km/s.
        chaser (Chaser): Chaser state after the mission (used for testing).

    """

    # Import scenario and initial conditions
    scenario = Scenario()
    scenario.import_yaml_scenario(scenario_name, ic_name)

    # Solve scenario
    solver = Solver()
    solver.initialize_solver(scenario)
    solver.solve_scenario()

    # Save manoeuvre plan
    if save:
        scenario.export_solved_scenario(solver.manoeuvre_plan)

    return solver.tot_dV, solver.chaser