Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit b5322f9

Browse files
authored
Merge pull request #62 from ltindall/small_fix
Fix data['action_taken']=None and small visual improvement
2 parents 81190c5 + 4b93b79 commit b5322f9

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

birdseye/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def plot_map(self, axis1=None, output=None, save_as='resultMap.png'):
204204
axis1.set_xlabel('Longitude')
205205
axis1.set_ylabel('Latitude')
206206
axis1.set_xticks(np.linspace(0,int(self.width_meters),num=8))
207-
axis1.set_xticklabels(self.x_ticks)
207+
axis1.set_xticklabels(self.x_ticks, rotation=30, ha='center')
208208
axis1.set_yticks(np.linspace(0,int(self.height_meters),num=8))
209209
axis1.set_yticklabels(self.y_ticks)
210210
axis1.grid()
@@ -324,10 +324,10 @@ def get_ticks(self):
324324
:return:
325325
"""
326326
self.x_ticks = map(
327-
lambda x: round(x, 6),
327+
lambda x: round(x, 4),
328328
np.linspace(self.bounds[1], self.bounds[3], num=8))
329329
self.y_ticks = map(
330-
lambda x: round(x, 6),
330+
lambda x: round(x, 4),
331331
np.linspace(self.bounds[2], self.bounds[0], num=8))
332332
# Ticks must be reversed because the orientation of the image in the matplotlib.
333333
# image - (0, 0) in upper left corner; coordinate system - (0, 0) in lower left corner
@@ -490,7 +490,7 @@ def live_plot(self, env, time_step=None, fig=None, ax=None, data=None):
490490
lines.extend([line5])
491491

492492
# Legend
493-
ax.legend(handles=lines, loc='upper center', bbox_to_anchor=(0.5,-0.05), fancybox=True, shadow=True,ncol=2)
493+
ax.legend(handles=lines, loc='upper left', bbox_to_anchor=(1.04, 1.0), fancybox=True, shadow=True, ncol=1)
494494

495495
# X/Y Limits
496496
if self.openstreetmap is None:
@@ -502,17 +502,20 @@ def live_plot(self, env, time_step=None, fig=None, ax=None, data=None):
502502

503503
# Sidebar Text
504504

505+
#actual_str = r'$\bf{Actual}$''\n' # prettier format but adds ~0.04 seconds ???
505506
actual_str = 'Actual\n'
506507
actual_str += 'Bearing = {:.0f} deg\n'.format(data.get('bearing',None)) if data.get('bearing', None) else 'Bearing = unknown\n'
507508
actual_str += 'Speed = {:.2f} m/s'.format(data.get('action_taken', None)[1]) if data.get('action_taken', None) else 'Speed = unknown\n'
508509

510+
#proposal_str = r'$\bf{Proposed}$''\n'
509511
proposal_str = 'Proposed\n'
510512
proposal_str += 'Bearing = {:.0f} deg\n'.format(data.get('action_proposal', None)[0]) if all(data.get('action_proposal', None)) else 'Bearing = unknown\n'
511513
proposal_str += 'Speed = {:.2f} m/s'.format(data.get('action_proposal', None)[1]) if all(data.get('action_proposal', None)) else 'Speed = unknown\n'
512514

513515
last_mean_hyp = self.pf_stats['mean_hypothesis'][-1][0]
514516
last_map_hyp = self.pf_stats['map_hypothesis'][-1][0]
515517

518+
#rssi_str = r'$\bf{RSSI}$''\n'
516519
rssi_str = 'RSSI\n'
517520
rssi_str += 'Observed = {:.1f} dB\n'.format(env.last_observation) if env.last_observation else 'Observed = unknown\n'
518521
rssi_str += 'Expected = {:.1f} dB\n'.format(self.expected_target_rssi) if self.expected_target_rssi else 'Expected = unknown\n'

sigscan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def main(config=None, debug=False):
202202
raise ValueError('planner_method not valid')
203203

204204
# Flask
205-
fig = plt.figure(figsize=(8,8), dpi=40)
205+
fig = plt.figure(figsize=(18,10), dpi=50)
206206
ax = fig.subplots()
207207
time_step = 0
208208
if config.get('flask', 'false').lower() == 'true':
@@ -226,7 +226,7 @@ def main(config=None, debug=False):
226226

227227
step_start = timer()
228228
# update belief based on action and sensor observation (sensor is read inside)
229-
belief, reward, observation = env.real_step(data.get('action_taken', (0,0)), data.get('bearing', None))
229+
belief, reward, observation = env.real_step(data['action_taken'] if data.get('action_taken', None) else (0,0), data.get('bearing', None))
230230
step_end = timer()
231231

232232
plot_start = timer()

0 commit comments

Comments
 (0)