Пример #1
0
def map():
    if not request.args.get('tag_search'):
        result = None
    else:
        result = get_photos(request.args.get('tag_search'))
    map_markers = generate_map(result)
    return map_markers.render()
Пример #2
0
def main(task):
    # load the map and expand it
    img, xscale, yscale = generate_map()
    c_img = expand_map(img, DENIRO_width)

    # load the motion planner
    planner = MotionPlanner(c_img, (xscale, yscale), goal=goal)

    if task == 'waypoints':
        print("============================================================")
        print("Running Waypoint Navigation")
        print("------------------------------------------------------------")
        planner.setup_waypoints()
        planner.run_planner(planner.waypoint_navigation)

    elif task == 'potential':
        print("============================================================")
        print("Running Potential Field Algorithm")
        print("------------------------------------------------------------")
        planner.run_planner(planner.potential_field)

    elif task == 'prm':
        print("============================================================")
        print("Running Probabilistic Road Map")
        print("------------------------------------------------------------")
        points = planner.generate_random_points(N_points=100)
        graph, edges = planner.create_graph(points)
        planner.dijkstra(graph, edges)
        planner.run_planner(planner.waypoint_navigation)
    elif task == 'heatmap':
        print("============================================================")
        print("Running Gravitational Heatmap")
        print("============================================================")

        step = 3
        velmap = np.zeros([323, 323])
        arrstep = ceil(323 / step)
        velmapx = np.zeros([arrstep, arrstep])
        velmapy = np.zeros([arrstep, arrstep])
        for y in range(0, velmap.shape[0], step):
            for x in range(0, velmap.shape[1], step):
                #deniro_position = planner.world_position(np.array([x, y]))
                force, complete = planner.potential_field(
                    deniro_pos=planner.world_position(np.array([x, y])))
                #velmap[y][x] = np.linalg.norm(force)
                velmapx[int(y / step), int(x / step)] = force[0, 0]
                velmapy[int(y / step), int(x / step)] = force[0, 1]
            # print(x, y, planner.world_position(np.array([x, y])), np.linalg.norm(force))

        X, Y = np.meshgrid(np.arange(0, 323, step), np.arange(0, 323, step))
        plt.quiver(X, Y, velmapx, velmapy, scale=0.4, scale_units='xy')
        plt.imshow(planner.pixel_map,
                   vmin=0,
                   vmax=1,
                   origin='lower',
                   cmap="Greys")
        plt.show()
Пример #3
0
def run_trip_assistance():
    all_bus_stops = load_all_bus_stops(DATE)

    selected_line_number = ask_for_line_number()

    src_address = ask_for_src_address()
    src_point = address_to_location(src_address)
    src_bus_stops = bus_stops_in_range(src_point, WALK_DISTANCE_IN_M, all_bus_stops)

    dst_address = ask_for_dst_address()
    dst_point = address_to_location(dst_address)
    dst_bus_stops = bus_stops_in_range(dst_point, WALK_DISTANCE_IN_M, all_bus_stops)

    vehicles = load_vehicles_data()

    bus_rides = load_bus_rides_for_line(selected_line_number, DATE)
    trip = recommend_trip(src_bus_stops, dst_bus_stops, bus_rides)

    if trip:
        generate_map(vehicles, trip)
        print_info_about_trip(trip)
    else:
        print_no_bus_info()
Пример #4
0
 def __init__(self, w, h):
     self.size = (w, h)
     self.focus = list(resolution_2)
     self.layers = map.generate_map(w, h)
     self.scroller = ccly.ScrollingManager()
     self.scroller.add(name="bg", child=self.layers[0])
     self.scroller.add(name="path", child=self.layers[1])
     self.scroller.add(name="item", child=self.layers[2])
     self.scroller.add(name="chess", child=self.layers[3])
     self.origin = ((0, 12), (29, 12))
     chesses_loc_dict = {
         "ChessArcher": (-1, -1),
         "ChessAssassin": (-1, -1),
         "ChessSwordman": (-1, -1),
         "ChessKnight": (-1, -1),
         "ChessFriar": (-1, -1),
         "ChessMage": (-1, -1),
         "ChessProphet": (-1, -1),
         "ChessWitch": (-1, -1)
     }
     self.chesses_loc = (chesses_loc_dict.copy(), chesses_loc_dict.copy())
Пример #5
0
    def __init__(self, sizeIn, levelIn):
        self.maps = []
        self.level = levelIn
        self.size = sizeIn
        size = sizeIn
        for x in range(0, size):
            self.maps.append([])
            for y in range(0, size):
                left_side = (x == 0)
                top_side = (y == 0)
                right_side = (x == size - 1)
                bottom_side = (y == size - 1)

                lands = [1, 1, 1, 1, 1, 1, 1, 1, 1]
                #CORNERS
                if x == 0 and y == 0:
                    lands = [0, 0, 0, 0, 0, 0, 0, 0, 1]
                elif x == 0 and y == size - 1:
                    lands = [0, 0, 1, 0, 0, 0, 0, 0, 0]
                elif x == size - 1 and y == 0:
                    lands = [0, 0, 0, 0, 0, 0, 1, 0, 0]
                elif x == size - 1 and y == size - 1:
                    lands = [1, 0, 0, 0, 0, 0, 0, 0, 0]
                #SIDES
                elif x == 0:
                    lands = [0, 0, 1, 0, 0, 1, 0, 0, 1]
                elif x == size - 1:
                    lands = [1, 0, 0, 1, 0, 0, 1, 0, 0]
                elif y == 0:
                    lands = [0, 0, 0, 0, 0, 0, 1, 1, 1]
                elif y == size - 1:
                    lands = [1, 1, 1, 0, 0, 0, 0, 0, 0]
                #MIDDLE
                elif y == size / 2 and x == size / 2:
                    lands = [1, 1, 1, 1, 0, 1, 1, 1, 1]
                m = map.generate_map(MAP_SIZE, lands, levelIn)
                self.maps[x].append(m)
Пример #6
0
from map import generate_map


if __name__ == "__main__":
    generate_map()


Пример #7
0
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry

from map import generate_map, expand_map, DENIRO_width
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import rospy
import sys

deniro_position = np.array([0, -6.0])
deniro_heading = 0.0
deniro_linear_vel = 0.0
deniro_angular_vel = 0.0

map = generate_map()

initial_position = np.array([0.0, -6.0])
goal = np.array([8.0, 8.0])


def deniro_odom_callback(msg):
    global deniro_position, deniro_heading, deniro_linear_vel, deniro_angular_vel
    deniro_position = np.array(
        [msg.pose.pose.position.x, msg.pose.pose.position.y])
    r = R.from_quat([
        msg.pose.pose.orientation.x, msg.pose.pose.orientation.y,
        msg.pose.pose.orientation.z, msg.pose.pose.orientation.w
    ])
    deniro_heading = r.as_euler('xyz')[2]
    deniro_linear_vel = np.sqrt(msg.twist.twist.linear.x**2 +
Пример #8
0
 def __init__(self):
     self.map = map.generate_map(map.map_width,map.map_height)