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
20d3bbb1
Commit
20d3bbb1
authored
7 years ago
by
Davis, Duane T
Browse files
Options
Downloads
Patches
Plain Diff
MONTE CARLO: Updates to support Monte Carlo Localization lab
parent
8beb1c41
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cs4313_utilities/geometry.py
+1
-1
1 addition, 1 deletion
src/cs4313_utilities/geometry.py
src/cs4313_utilities/maps.py
+14
-18
14 additions, 18 deletions
src/cs4313_utilities/maps.py
src/cs4313_utilities/shared_robot_classes.py
+1
-0
1 addition, 0 deletions
src/cs4313_utilities/shared_robot_classes.py
with
16 additions
and
19 deletions
src/cs4313_utilities/geometry.py
+
1
−
1
View file @
20d3bbb1
...
...
@@ -507,7 +507,7 @@ class Polygon(Geometry):
closest
=
None
min_d
=
0.0
for
edge
in
self
.
edges
:
closest_seg_pt
=
rm
.
closest_point_on_egment
t
(
edge
[
0
],
edge
[
1
],
point
)
closest_seg_pt
=
rm
.
closest_point_on_
s
egment
(
edge
[
0
],
edge
[
1
],
point
)
seg_d
=
rm
.
cartesian_distance
(
point
,
closest_seg_pt
)
if
(
not
closest
)
or
(
seg_d
<
min_d
):
closest
=
closest_seg_pt
...
...
This diff is collapsed.
Click to expand it.
src/cs4313_utilities/maps.py
+
14
−
18
View file @
20d3bbb1
...
...
@@ -341,18 +341,17 @@ class GeometryMap(Map):
def
nearest_obstacle
(
self
,
point
):
'''
Computes distance from a test point to the nearest mapped obstacle
@param point: Cartesian coordi
a
ntes of the test point
@return: tuple
containing
the
clo
sest obstacle
point and the distance
@param point: Cartesian coordin
a
tes of the test point
@return: tuple
with
the
near
sest obstacle
and distance from the test point
'''
closest_point
=
None
min_d
=
0
.0
obstacle
=
None
min_d
=
-
1
.0
for
geometry
in
self
.
_geometries
:
pt
=
geometry
.
closest_point
(
point
)
d
=
self
.
distance
(
point
,
pt
)
if
(
closest_point
==
None
)
or
(
d
<
min_d
):
closest_point
=
pt
d
=
geometry
.
edge_distance
(
point
)
if
(
not
obstacle
)
or
(
d
<
min_d
):
obstacle
=
geometry
min_d
=
d
return
(
closest_point
,
min_d
)
return
(
geometry
,
min_d
)
def
distance
(
self
,
state1
,
state2
):
...
...
@@ -380,15 +379,12 @@ class GeometryMap(Map):
test_pt
=
\
rm
.
projectSensorReturnToWorld
(
state
,
self
.
_sensor_posit
,
\
rng
,
theta_sense
)
distance
=
rm
.
BIGNUM
for
obstacle
in
self
.
_geometries
:
d_obs
=
obstacle
.
edge_distance
(
test_pt
)
if
d_obs
<
distance
:
distance
=
d_obs
result
*=
rm
.
likelihoodFieldModel
(
distance
,
self
.
_z_max
,
\
self
.
_sigma_like
,
\
self
.
_alpha_hit_like
,
\
self
.
_alpha_rand_like
)
(
_
,
distance
)
=
self
.
nearest_obstacle
(
test_pt
)
if
distance
>
0.0
:
result
*=
rm
.
likelihoodFieldModel
(
distance
,
self
.
_z_max
,
\
self
.
_sigma_like
,
\
self
.
_alpha_hit_like
,
\
self
.
_alpha_rand_like
)
return
result
...
...
This diff is collapsed.
Click to expand it.
src/cs4313_utilities/shared_robot_classes.py
+
1
−
0
View file @
20d3bbb1
...
...
@@ -35,6 +35,7 @@ class RobotState(object):
@param initVelocity: initial xDot, yDot, thetaDot (default [0, 0, 0] )
'''
self
.
pose
=
[
initPose
[
0
],
initPose
[
1
],
initPose
[
2
]
]
self
.
odom_prev
=
[
initPose
[
0
],
initPose
[
1
],
initPose
[
2
]
]
self
.
odom
=
[
initPose
[
0
],
initPose
[
1
],
initPose
[
2
]
]
self
.
velocity
=
[
initVelocity
[
0
],
initVelocity
[
1
],
initVelocity
[
2
]
]
...
...
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