parameters: (self, steering, distance, tolerance=0.001, max_steering_angle=np.pi / 4.0)
docstring: steering = front wheel steering angle, limited by max_steering_angle
          distance = total distance driven, most be non-negative
docstring_summary: steering = front wheel steering angle, limited by max_steering_angle
          distance = total distance driven, most be non-negative
docstring_tokens: steering = front wheel steering angle limited by max_steering_angle distance = total distance driven most be non - negative
function: def move(self, steering, distance, tolerance=0.001, max_steering_angle=np.pi / 4.0):
          """
          steering = front wheel steering angle, limited by max_steering_angle
          distance = total distance driven, most be non-negative
          """
          if steering > max_steering_angle:
              steering = max_steering_angle
          if steering < -max_steering_angle:
              steering = -max_steering_angle
          if distance < 0.0:
              distance = 0.0
  
          # make a new copy
          # res = Robot()
          # res.length = self.length
          # res.steering_noise = self.steering_noise
          # res.distance_noise = self.distance_noise
          # res.steering_drift = self.steering_drift
  
          # apply noise
          steering2 = random.gauss(steering, self.steering_noise)
          distance2 = random.gauss(distance, self.distance_noise)
  
          # apply steering drift
          steering2 += self.steering_drift
  
          # Execute motion
          turn = np.tan(steering2) * distance2 / self.length
  
          if abs(turn) < tolerance:
              # approximate by straight line motion
              self.x += distance2 * np.cos(self.orientation)
              self.y += distance2 * np.sin(self.orientation)
              self.orientation = (self.orientation + turn) % (2.0 * np.pi)
          else:
              # approximate bicycle model for motion
              radius = distance2 / turn
              cx = self.x - (np.sin(self.orientation) * radius)
              cy = self.y + (np.cos(self.orientation) * radius)
              self.orientation = (self.orientation + turn) % (2.0 * np.pi)
              self.x = cx + (np.sin(self.orientation) * radius)
              self.y = cy - (np.cos(self.orientation) * radius)
function_tokens: def move ( self , steering , distance , tolerance = 0.001 , max_steering_angle = np . pi / 4.0 ) : if steering > max_steering_angle : steering = max_steering_angle if steering < - max_steering_angle : steering = - max_steering_angle if distance < 0.0 : distance = 0.0 # make a new copy # res = Robot() # res.length = self.length # res.steering_noise = self.steering_noise # res.distance_noise = self.distance_noise # res.steering_drift = self.steering_drift # apply noise steering2 = random . gauss ( steering , self . steering_noise ) distance2 = random . gauss ( distance , self . distance_noise ) # apply steering drift steering2 += self . steering_drift # Execute motion turn = np . tan ( steering2 ) * distance2 / self . length if abs ( turn ) < tolerance : # approximate by straight line motion self . x += distance2 * np . cos ( self . orientation ) self . y += distance2 * np . sin ( self . orientation ) self . orientation = ( self . orientation + turn ) % ( 2.0 * np . pi ) else : # approximate bicycle model for motion radius = distance2 / turn cx = self . x - ( np . sin ( self . orientation ) * radius ) cy = self . y + ( np . cos ( self . orientation ) * radius ) self . orientation = ( self . orientation + turn ) % ( 2.0 * np . pi ) self . x = cx + ( np . sin ( self . orientation ) * radius ) self . y = cy - ( np . cos ( self . orientation ) * radius )