Skip to content
Snippets Groups Projects
Commit 536de9d8 authored by Davis, Duane T's avatar Davis, Duane T
Browse files

Commented out unimplemented laser model functions

parent b78cdbda
No related branches found
No related tags found
No related merge requests found
......@@ -177,72 +177,73 @@ def likelihoodFieldModel(distance, z_max, sigma, alpha_hit, alpha_rand):
return alpha_hit * gaussian_PDF(distance, sigma) + alpha_rand / z_max
def rangeSensorModel(z, z_exp, z_max, sigma, lamda, \
alpha_hit, alpha_unexp, alpha_max, alpha_rand):
''' Implements the range sensor model from the CS4313 lecture material
@param z: sensor reading (range) being checked
@param z_exp: expected value (i.e., expected range to the obstacle)
@param z_max: sensor's maximum range
@param sigma: standard deviation of the hit model Gaussian
@param lamda: rate parameter of the obstacle model exponential
@param alpha_hit: normalized coefficient for the hit model
@param alpha_unexp: normalized coefficient for the obstacle model
@param alpha_max: normalized coefficient for the maximum range model
@param alpha_rand: normalized coefficient for the random return model
@return: PDF value for the probability that the return corresponds to the map
'''
return alpha_hit * rangeSensorHitModel(z, z_exp, sigma) + \
alpha_unexp * rangeSensorObstacleModel(z, z_exp, lamda) + \
alpha_rand * rangeSensorRandomModel(z_max) + \
alpha_max * rangeSensorMaxRangeModel(z, z_max)
def rangeSensorHitModel(z, z_exp, sigma):
''' Computes the probability that a given sensor reading is from a mapped
obstacle using a Gaussian distribution centered on the expected range
@param z: sensor reading (range) being checked
@param z_exp: expected value (i.e., expected range to the obstacle)
@param sigma: standard deviation of the Gaussian
@return: the PDF value that the return is from a mapped obstacle
'''
return gaussian_PDF((z-z_exp), sigma)
def rangeSensorObstacleModel(z, z_exp, lamda):
''' Computes the probability of a given sensor reading is from an
unmapped obstacle using an exponential distribution
@param z: sensor reading (range) being checked
@param z_exp: expected value (i.e., expected range to the obstacle)
@param lamda: rate parameter of the distribution
@return: the PDF value that the return is from an unmapped obstacle
'''
if z > z_exp:
return 0.0 # Can't detect an obstacle beyond the mapped one
exponential = math.exp(-lamda * z)
eta = 1.0 / (1.0 - exponential)
return eta * lamda * exponential
def rangeSensorRandomModel(z_max):
''' Computes the probability that a return is just a random return
using a uniform distribution between 0 and the maximum range
@param z_max: sensor's maximum range
@return: PDF value that the return is random
'''
return 1.0 / z_max
def rangeSensorMaxRangeModel(z, z_max):
''' Computes the probability that a return is a maximum range return
(i.e., not object detected)
@param z: sensor reading (range) being checked
@param z_max: maximum range of the sensor
@return the PDF value that the specific return was a max-range return
'''
if abs(z - z_max) <= SMALLNUM:
return 1.0
return 0.0
# NOTE: Model not implemented yet (commented out for now)
#def rangeSensorModel(z, z_exp, z_max, sigma, lamda, \
# alpha_hit, alpha_unexp, alpha_max, alpha_rand):
# ''' Implements the range sensor model from the CS4313 lecture material
# @param z: sensor reading (range) being checked
# @param z_exp: expected value (i.e., expected range to the obstacle)
# @param z_max: sensor's maximum range
# @param sigma: standard deviation of the hit model Gaussian
# @param lamda: rate parameter of the obstacle model exponential
# @param alpha_hit: normalized coefficient for the hit model
# @param alpha_unexp: normalized coefficient for the obstacle model
# @param alpha_max: normalized coefficient for the maximum range model
# @param alpha_rand: normalized coefficient for the random return model
# @return: PDF value for the probability that the return corresponds to the map
# '''
# return alpha_hit * rangeSensorHitModel(z, z_exp, sigma) + \
# alpha_unexp * rangeSensorObstacleModel(z, z_exp, lamda) + \
# alpha_rand * rangeSensorRandomModel(z_max) + \
# alpha_max * rangeSensorMaxRangeModel(z, z_max)
#
#
#def rangeSensorHitModel(z, z_exp, sigma):
# ''' Computes the probability that a given sensor reading is from a mapped
# obstacle using a Gaussian distribution centered on the expected range
# @param z: sensor reading (range) being checked
# @param z_exp: expected value (i.e., expected range to the obstacle)
# @param sigma: standard deviation of the Gaussian
# @return: the PDF value that the return is from a mapped obstacle
# '''
# return gaussian_PDF((z-z_exp), sigma)
#
#
#def rangeSensorObstacleModel(z, z_exp, lamda):
# ''' Computes the probability of a given sensor reading is from an
# unmapped obstacle using an exponential distribution
# @param z: sensor reading (range) being checked
# @param z_exp: expected value (i.e., expected range to the obstacle)
# @param lamda: rate parameter of the distribution
# @return: the PDF value that the return is from an unmapped obstacle
# '''
# if z > z_exp:
# return 0.0 # Can't detect an obstacle beyond the mapped one
#
# exponential = math.exp(-lamda * z)
# eta = 1.0 / (1.0 - exponential)
# return eta * lamda * exponential
#
#
#def rangeSensorRandomModel(z_max):
# ''' Computes the probability that a return is just a random return
# using a uniform distribution between 0 and the maximum range
# @param z_max: sensor's maximum range
# @return: PDF value that the return is random
# '''
# return 1.0 / z_max
#
#
#def rangeSensorMaxRangeModel(z, z_max):
# ''' Computes the probability that a return is a maximum range return
# (i.e., not object detected)
# @param z: sensor reading (range) being checked
# @param z_max: maximum range of the sensor
# @return the PDF value that the specific return was a max-range return
# '''
# if abs(z - z_max) <= SMALLNUM:
# return 1.0
# return 0.0
def projectSensorReturnToWorld(state, sensor_posit, rng, brg):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment