In [ ]:
import sys
sys.path.append("/home/mw/PycharmProjects/eurobot-hauptsteuerung/eurobot")

%matplotlib inline
import time
import math
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
from hauptsteuerung.route_finding import *
from libraries import can

In [ ]:
can_socket = can.Can('vcan0', can.MsgSender.Hauptsteuerung)
route_finder = RouteFinding(can_socket)

In [24]:
table = route_finder._make_table(40)
print(table.shape)
plt.imshow(table)
plt.colorbar()


(40, 60)
Out[24]:
<matplotlib.colorbar.Colorbar at 0x7f08f4cd2a20>

In [7]:
from scipy.ndimage import morphology 
test = morphology.grey_dilation(table, size=(5, 5))
plt.imshow(test)
plt.colorbar()


Out[7]:
<matplotlib.colorbar.Colorbar at 0x7f090ed0e588>

In [9]:
robot = route_finder._make_robot(20)
plt.imshow(robot)
plt.colorbar()


Out[9]:
<matplotlib.colorbar.Colorbar at 0x7fc7843cf978>

In [45]:
gamefield = np.copy(table)
table_bot = route_finder._add_array(gamefield, robot, (750, 1000))
plt.imshow(table_bot)
plt.colorbar()


750 1000
Out[45]:
<matplotlib.colorbar.Colorbar at 0x7f638f35cef0>

In [46]:
route = route_finder._find_route(table_bot)
for point in route:
    gamefield[point] = 120
plt.imshow(table_bot)
plt.colorbar()


Out[46]:
<matplotlib.colorbar.Colorbar at 0x7f638ef86588>

In [ ]: