|
|
@ -5,10 +5,10 @@ import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_noise(distance, angle, sigma):
|
|
|
|
def add_noise(distance, angle, sigma):
|
|
|
|
mean = np.array[distance, angle]
|
|
|
|
_mean = np.array([distance, angle])
|
|
|
|
# Noise for distance or angle are not correlated
|
|
|
|
# Noise for distance or angle are not correlated
|
|
|
|
covariance = np.diag(sigma ** 2)
|
|
|
|
covariance = np.diag(sigma ** 2)
|
|
|
|
new_distance, new_angle = np.random.multivariate_normal(mean, covariance)
|
|
|
|
new_distance, new_angle = np.random.multivariate_normal(_mean, covariance)
|
|
|
|
# Don't want negative values
|
|
|
|
# Don't want negative values
|
|
|
|
new_distance = max(new_distance, 0)
|
|
|
|
new_distance = max(new_distance, 0)
|
|
|
|
new_angle = max(new_angle, 0)
|
|
|
|
new_angle = max(new_angle, 0)
|
|
|
@ -32,7 +32,7 @@ class Lidar2DSensor:
|
|
|
|
self.sigma = np.array([self._uncertainty[0], self._uncertainty[1]])
|
|
|
|
self.sigma = np.array([self._uncertainty[0], self._uncertainty[1]])
|
|
|
|
# TODO make this a value of the robot.
|
|
|
|
# TODO make this a value of the robot.
|
|
|
|
self.position = (0, 0)
|
|
|
|
self.position = (0, 0)
|
|
|
|
self.map_width, self.map_height = self.map.get_surface().get_size()
|
|
|
|
self.map_width, self.map_height = self.map.get_size()
|
|
|
|
self.sensor_point_cloud = []
|
|
|
|
self.sensor_point_cloud = []
|
|
|
|
self.colors = colors
|
|
|
|
self.colors = colors
|
|
|
|
|
|
|
|
|
|
|
|