Commit f9c96327 authored by Bryson Howell's avatar Bryson Howell

Added test LPM pattern for testing path curving. Updated git ignore to ignore .pyc

parent c4c3d302
...@@ -11,3 +11,4 @@ BW_LFandInac_Zelev.mat ...@@ -11,3 +11,4 @@ BW_LFandInac_Zelev.mat
e_x_y_data.pkl e_x_y_data.pkl
.pytest_cache .pytest_cache
z__test__*.pyc z__test__*.pyc
*.pyc
...@@ -228,17 +228,36 @@ class MonteCarlo(params.Default): ...@@ -228,17 +228,36 @@ class MonteCarlo(params.Default):
self.p[dist_mat <= self.params['ring_mobi'][3]] += 0.20 # containment ring self.p[dist_mat <= self.params['ring_mobi'][3]] += 0.20 # containment ring
# print(self.p) # print(self.p)
self.p = ndimage.gaussian_filter(self.p, sigma=8) # to make betta heatmap self.p = ndimage.gaussian_filter(self.p, sigma=8) # to make betta heatmap
#Makes heatmap favoring a corner
elif self.params['lp_model'] == 'trust': #test for trust elif self.params['lp_model'] == 'trust': #test for trust
self.p = np.zeros((self._x_shape, self._y_shape), dtype=float) self.p = np.zeros((self._x_shape, self._y_shape), dtype=float)
for r in range(0, self._x_shape): for r in range(0, self._x_shape):
for c in range(0, self._y_shape): for c in range(0, self._y_shape):
self.p[r,c] = np.float(r+c) / np.float(self._x_shape+self._y_shape) self.p[r,c] = np.float(r+c) / np.float(self._x_shape+self._y_shape)
#Makes heatmap with horizontal stripes, paths should bend to them
elif self.params['lp_model'] == 'stripes':
self.p = np.zeros((self._x_shape, self._y_shape), dtype=float)
line_width = 5
line_focus = np.int(self._x_shape / (self.params['num_robots']))
for r in range(0, self._x_shape):
for c in range(0, self._y_shape):
#ik there's a better way to do this...
if(r > line_focus-line_width and r <= line_focus+line_width):
self.p[r,c] = 1 - np.abs(line_focus-r)/line_width
elif(r > 2*line_focus-line_width and r <= 2*line_focus+line_width):
self.p[r,c] = 1 - np.abs(2*line_focus-r)/line_width
elif(r > 3*line_focus-line_width and r <= 3*line_focus+line_width):
self.p[r,c] = 1 - np.abs(3*line_focus-r)/line_width
#No heatmap loaded
else: else:
self.p = np.zeros((self._x_shape, self._y_shape), dtype=float) self.p = np.zeros((self._x_shape, self._y_shape), dtype=float)
#Show LP Heatmap #Show LP Heatmap
show = False show = False
if(show): if(show):
print('Environment shape = %d x %d' % (self._x_shape,self._y_shape))
plt.imshow(self.p) plt.imshow(self.p)
plt.title('Selected heatmap') plt.title('Selected heatmap')
plt.show() plt.show()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment