robot_class.py
def sense(self):
        ''' This function does not take in any parameters, instead it references internal variables
            (such as self.landamrks) to measure the distance between the robot and any landmarks
            that the robot can see (that are within its measurement range).
            This function returns a list of landmark indices, and the measured distances (dx, dy)
            between the robot's position and said landmarks.
            This function should account for measurement_noise and measurement_range.
            One item in the returned list should be in the form: [landmark_index, dx, dy].
            '''
           
        measurements = []
        
        dx, dy = 0, 0
        
        for landmark_idx in range(self.num_landmarks):
        
            ## compute dx and dy, the distances between the robot and the landmark
            dx = self.landmarks[landmark_idx][0] - self.x
            dy = self.landmarks[landmark_idx][1] - self.y
            
            ## 2. account for measurement noise by *adding* a noise component to dx and dy
            dx = dx + self.rand() * self.measurement_noise
            dy = dy + self.rand() * self.measurement_noise
            
            ## 3. If either of the distances, dx or dy, fall outside of the internal var, measurement_range
            ##    then we cannot record them; if they do fall in the range, then add them to the measurements list
            ##    as list.append([index, dx, dy]), this format is important for data creation done later
            if abs(dx) > self.measurement_range or abs(dy) > self.measurement_range:
                print('Measurement out of range...', end='\r')
            else:
                records = [landmark_idx, dx, dy]
                measurements.append(records)
            
        
        return measurements
 This function does not take in any parameters, instead it references internal variables
            (such as self.landamrks) to measure the distance between the robot and any landmarks
            that the robot can see (that are within its measurement range).
            This function returns a list of landmark indices, and the measured distances (dx, dy)
            between the robot's position and said landmarks.
            This function should account for measurement_noise and measurement_range.
            One item in the returned list should be in the form: [landmark_index, dx, dy].
            
This function does not take in any parameters, instead it references internal variables
(such as self.landamrks) to measure the distance between the robot and any landmarks
that the robot can see (that are within its measurement range).
This function returns a list of landmark indices, and the measured distances (dx, dy)
between the robot's position and said landmarks.
This function should account for measurement_noise and measurement_range.
One item in the returned list should be in the form: [landmark_index, dx, dy].
This function does not take in any parameters instead it references internal variables ( such as self . landamrks ) to measure the distance between the robot and any landmarks that the robot can see ( that are within its measurement range ) . This function returns a list of landmark indices and the measured distances ( dx dy ) between the robot ' s position and said landmarks . This function should account for measurement_noise and measurement_range . One item in the returned list should be in the form : [ landmark_index dx dy ] .
def sense(self):
        measurements = []
        dx, dy = 0, 0
        for landmark_idx in range(self.num_landmarks):
            dx = self.landmarks[landmark_idx][0] - self.x
            dy = self.landmarks[landmark_idx][1] - self.y
            dx = dx + self.rand() * self.measurement_noise
            dy = dy + self.rand() * self.measurement_noise
            if abs(dx) > self.measurement_range or abs(dy) > self.measurement_range:
                print('Measurement out of range...', end='\r')
            else:
                records = [landmark_idx, dx, dy]
                measurements.append(records)
        return measurements
def sense ( self ) : measurements = [ ] dx , dy = 0 , 0 for landmark_idx in range ( self . num_landmarks ) : dx = self . landmarks [ landmark_idx ] [ 0 ] - self . x dy = self . landmarks [ landmark_idx ] [ 1 ] - self . y dx = dx + self . rand ( ) * self . measurement_noise dy = dy + self . rand ( ) * self . measurement_noise if abs ( dx ) > self . measurement_range or abs ( dy ) > self . measurement_range : print ( 'Measurement out of range...' , end = '\r' ) else : records = [ landmark_idx , dx , dy ] measurements . append ( records ) return measurements
This function does not take in any parameters, instead it references internal variables
(such as self.landamrks) to measure the distance between the robot and any landmarks
that the robot can see (that are within its measurement range).
This function does not take in any parameters instead it references internal variables ( such as self . landamrks ) to measure the distance between the robot and any landmarks that the robot can see ( that are within its measurement range ) .
''' This function does not take in any parameters, instead it references internal variables
            (such as self.landamrks) to measure the distance between the robot and any landmarks
            that the robot can see (that are within its measurement range).
            This function returns a list of landmark indices, and the measured distances (dx, dy)
            between the robot's position and said landmarks.
            This function should account for measurement_noise and measurement_range.
            One item in the returned list should be in the form: [landmark_index, dx, dy].
            ''' ## compute dx and dy, the distances between the robot and the landmark ## 2. account for measurement noise by *adding* a noise component to dx and dy ## 3. If either of the distances, dx or dy, fall outside of the internal var, measurement_range ##    then we cannot record them; if they do fall in the range, then add them to the measurements list ##    as list.append([index, dx, dy]), this format is important for data creation done later
self