User Tools

Site Tools


cs401r_w2016:lab8

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
cs401r_w2016:lab8 [2018/03/12 22:27]
sadler [Description:]
cs401r_w2016:lab8 [2018/03/12 22:32]
sadler [Hints:]
Line 115: Line 115:
  
 The combination of these two things allowed me to experiment with my particle filter in real-time. ​ Note that you are not required to produce any sort of visualization over time, just a single plot at the end of running your code.  The use of ''​pyqtgraph''​ is strictly for the work you will do debugging your particle filter. The combination of these two things allowed me to experiment with my particle filter in real-time. ​ Note that you are not required to produce any sort of visualization over time, just a single plot at the end of running your code.  The use of ''​pyqtgraph''​ is strictly for the work you will do debugging your particle filter.
 +
 +Or if you want to use matplotLib which is better for Jupyter Notebook but slower, here is some code for plotting at each iteration:
 +<code python>
 +import matplotlib.pyplot
 +import numpy
 +from IPython.display import clear_output
 +
 +def draw(particles,​ true_values,​ predicted_values,​ t):
 +    clear_output(wait=True)
 +    show_map( room_map )
 +    plt.scatter(particles[0,:​] , particles[1,:​],​ c="​yellow"​)
 +    plt.plot(true_values[0,:​t], ​ true_values[1,:​t] , c= "​green",​ label="​Actual Position"​)
 +    plt.plot(predicted_values[0,:​t],​ predicted_values[1,:​t],​ c= "​red",​ label="​Estimated Position"​)
 +    plt.legend(loc=1)
 +    plt.show()
 +</​code>​
cs401r_w2016/lab8.txt · Last modified: 2021/06/30 23:42 (external edit)