Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs4313_utilities
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CS4313
cs4313_utilities
Commits
536de9d8
"...src/git@gitlab.nps.edu:Savage/NetworkedGraphicsMV3500.git" did not exist on "3cbdf04c311ae26cd2967a28f7483ad697981f0e"
Commit
536de9d8
authored
5 years ago
by
Davis, Duane T
Browse files
Options
Downloads
Patches
Plain Diff
Commented out unimplemented laser model functions
parent
b78cdbda
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cs4313_utilities/robot_math.py
+67
-66
67 additions, 66 deletions
src/cs4313_utilities/robot_math.py
with
67 additions
and
66 deletions
src/cs4313_utilities/robot_math.py
+
67
−
66
View file @
536de9d8
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment