def generate_NBA():
    start = datetime.datetime.now()
    task = Task()
    buchi = Buchi(task)
    buchi.construct_buchi_graph()
    buchi.get_minimal_length()
    buchi.get_feasible_accepting_state()
    buchi_graph = buchi.buchi_graph
    NBA_time = (datetime.datetime.now() - start).total_seconds()
    print('Time for constructing the NBA: {0:.4f} s'.format(NBA_time))
    return buchi, buchi_graph
示例#2
0
# plot_workspace(workspace)
# plt.show()

with open('data/workspace', 'wb') as filehandle:
    pickle.dump(workspace, filehandle)

# with open('data/workspace', 'rb') as filehandle:
#     workspace.p2p = pickle.load(filehandle)
# workspace.plot_workspace()
# plt.show()

start = datetime.now()

task = Task()

buchi = Buchi(task, workspace)


buchi.construct_buchi_graph()
print((datetime.now()-start).total_seconds())
# print('partial time: {0}'.format((datetime.now() - start).total_seconds()))
print(buchi.buchi_graph.number_of_nodes(), buchi.buchi_graph.number_of_edges())


init_state, accept_state, is_nonempty_self_loop = buchi.get_init_accept()

# is_nonempty_self_loop = False

pruned_subgraph, paths = buchi.get_subgraph(init_state, accept_state, is_nonempty_self_loop)

print(pruned_subgraph.number_of_nodes(), pruned_subgraph.number_of_edges())
    identity = 'run1'
    number_of_trials = 1
    save_waypoints = True
    save_covariances = True
    drone_height = 16.0  # altitude of drones
    waypoint_folder_location = "/home/samarth/catkin_ws/src/rotors_simulator/rotors_gazebo/resource"
    launch_folder_location = "/home/samarth/catkin_ws/src/rotors_simulator/rotors_gazebo/launch"

    time_array = []  #stores time for each trial run
    cost_array = []  #stores cost of each trial run

    for round_num in range(number_of_trials):
        print('Trial {}'.format(round_num + 1))
        start = datetime.datetime.now()
        task = Task()
        buchi = Buchi(task)
        buchi.construct_buchi_graph()
        buchi.get_minimal_length()
        buchi.get_feasible_accepting_state()
        buchi_graph = buchi.buchi_graph
        NBA_time = (datetime.datetime.now() - start).total_seconds()
        print('Time for constructing the NBA: {0:.4f} s'.format(NBA_time))

        # workspace
        workspace = Workspace()
        geodesic = Geodesic(workspace, task.threshold)
        # parameters
        n_max = 100000
        para = dict()
        # lite version, excluding extending and rewiring
        para['is_lite'] = True
示例#4
0
# -*- coding: utf-8 -*-

import numpy as np
import math
from shapely.geometry import Point, LineString, shape
from shapely.ops import nearest_points
from buchi_parse import Buchi
from workspace import Workspace
from task import Task

workspace = Workspace()
task = Task()
buchi = Buchi(task)
obstacles = workspace.obs


def calculate_STL_cost(new_state, neighbor_state):

    (minVal, mobs, maxVal,
     Mobs) = max_min_distances_to_obs(new_state, neighbor_state)
    # min distance
    if mobs == 'o1':
        qsi_min = minVal - 0.1  # robot has to be at least 0.3m away from obstacles

    elif mobs == 'o2':
        qsi_min = minVal - 0.1
    """ 	# max distance
    if Mobs=='o1':
        qsi_max=0.5-maxVal # robot has to be less than 0.5m away from obstacles
        
    elif Mobs=='o2':