# Unit3-22: Solution vs. quiz skeleton code

 3 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 asplund-1 272●1●6●15 accept rate: 20%

 1 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. answered 08 Mar '12, 16:37 Phil Duby-1 2.6k●2●14●46
 0 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... answered 08 Mar '12, 15:39 Jose 2.0k●9●27●61
 0 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. answered 08 Mar '12, 15:46 marko asplund-1 272●1●6●15
 0 ok, myrobot is the robot position that's used later on e.g. in u3-23. answered 08 Mar '12, 16:04 marko asplund-1 272●1●6●15
 0 missed the measurement_prob() call that compares the robot and particle positions. answered 08 Mar '12, 16:45 marko asplund-1 272●1●6●15
Question text:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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

×5,185
×369
×46