Unit3-22: Solution vs. quiz skeleton code

The code seen on the solution video and the code in the quiz skeleton code seem to be different.
The line numbers don't match and it seems that in the code presented in the video some code that is commented out in the quiz skeleton code has been deleted.
Also, in the video the following two lines appear after initialization but they're not present in the skeleton code:


myrobot = myrobot.move(0.1, 5.0)
Z = myrobot.sense()

This seems to be dead code, though.

Not sure if there are any differences that would affect the result but it's a bit confusing.

aspa

asked 08 Mar '12, 15:38

marko%20asplund-1's gravatar image

marko asplund-1
2721615
accept rate: 20%


5 Answers:

In the original code, move and sense calls were done once before the loop that initialized the particles and particle noise. They were immediately after "myrobot = robot()". In the solution, the calls were moved after the particle initialization loop, ending up as the first items in the loop used to repeat the move, sense, calculate, resample cycle. Its not dead code, since the robot and particles are [to be] moved again [each time through loop] based on the previous calculated results. That moving is what actually [eventually] gets the orientation values to converge.

link

answered 08 Mar '12, 16:37

Phil%20Duby-1's gravatar image

Phil Duby-1
2.6k21446

I think because you have to sense a list of N=1000 particles, you don't create Z, but use the sense method directly with each particle. Or perhaps it is dead code which wrongly stood there...

link

answered 08 Mar '12, 15:39

Jose's gravatar image

Jose
2.0k92761

edited 08 Mar '12, 15:41

not sure if i understand.

in the skeleton code both myrobot and Z set but they're not used anywhere after that.
it's hard to see but also the solution on the video doesn't appear to do anything with neither myrobot nor Z.

link

answered 08 Mar '12, 15:46

marko%20asplund-1's gravatar image

marko asplund-1
2721615

ok, myrobot is the robot position that's used later on e.g. in u3-23.

link

answered 08 Mar '12, 16:04

marko%20asplund-1's gravatar image

marko asplund-1
2721615

missed the measurement_prob() call that compares the robot and particle positions.

link

answered 08 Mar '12, 16:45

marko%20asplund-1's gravatar image

marko asplund-1
2721615

Your answer
Question text:

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×5,185
×369
×46

Asked: 08 Mar '12, 15:38

Seen: 271 times

Last updated: 08 Mar '12, 16:45