Esempio n. 1
0
def cost_func(path):
    """ This cost function just returns the linear distance between the nodes (assumed to be spatial
            nodes)"""
    cost = 0
    for i in range(1, len(path)):
        cost += VecMath.length(
            VecMath.sub(path[i - 1].position, path[i].position))
    return cost
Esempio n. 2
0
def linear_distance_heuristic(path, goal):
    return VecMath.length(VecMath.sub(goal.position, path[-1].position))