What's the HW3-6 Solution

 1 Can someone post the complete set of the HW3-6 solution including the test case. As I still couldn't get the question right after I watched the Homework solution video. asked 15 Mar '12, 00:28 maninthemoon 21●5 accept rate: 50%

 1 For reference, here is my solution: def move(self, motion): # Do not change the name of this function # ADD CODE HERE alpha = float(motion[0]) + random.gauss(0.0, self.steering_noise) d = float(motion[1]) + random.gauss(0.0, self.distance_noise) beta = tan(alpha) * d / self.length new_orientation = (self.orientation + beta) new_orientation %= 2 * pi if abs(beta) < 0.001: new_x = self.x + d * cos(self.orientation) new_y = self.y + d * sin(self.orientation) else: R = d / beta cx = self.x - R * sin(self.orientation) cy = self.y + R * cos(self.orientation) new_x = cx + R * sin(self.orientation + beta) new_y = cy - R * cos(self.orientation + beta) result = robot(self.length) result.set(new_x, new_y, new_orientation) result.set_noise(self.bearing_noise, self.steering_noise, self.distance_noise) return result # make sure your move function returns an instance # of the robot class with the correct coordinates. def sense(self, noisy=1): #do not change the name of this function Z = [] for land in landmarks: bearing = atan2(land[0] - self.y, land[1] - self.x) - self.orientation if noisy == 1: bearing += random.gauss(0.0, self.bearing_noise) bearing %= 2 * pi Z.append(bearing) return Z #Leave this line here. Return vector Z of 4 bearings.  Note the optional parameter noisy=1 in sense and the addition of noise in calculations using random.gauss answered 16 Mar '12, 00:44 bhrgunatha 373 471●1●4●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
×195
×183