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
cb10e661
Commit
cb10e661
authored
6 years ago
by
Davis, Duane T
Browse files
Options
Downloads
Patches
Plain Diff
Code cleanup in maps.py and robot.py
parent
119f09c8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#1429
failed
6 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cs4313_utilities/maps.py
+7
-4
7 additions, 4 deletions
src/cs4313_utilities/maps.py
src/cs4313_utilities/robot.py
+5
-1
5 additions, 1 deletion
src/cs4313_utilities/robot.py
with
12 additions
and
5 deletions
src/cs4313_utilities/maps.py
+
7
−
4
View file @
cb10e661
...
...
@@ -9,6 +9,7 @@ import cs4313_utilities.geometry as geometry
import
cs4313_utilities.robot_math
as
rm
import
cs4313_utilities.shared_robot_classes
as
src
import
rospy
class
Map
(
object
):
'''
Abstract class for defining a map for robot navigation use. Class
...
...
@@ -371,12 +372,14 @@ class GeometryMap(Map):
@param sensor: sensor reading (should be a LaserData object)
@return model PDF value corresponding to P( z | x, m )
'''
# If the "state" isn't in free space, the likelihood is 0
if
not
self
.
is_free_space
(
state
):
return
0.0
result
=
1.0
# For efficiency
purposes
, only check interval of continuity
mid
pts
# For efficiency, only check interval of continuity
closest
pts
for
interval
in
sensor
.
intervals
:
test_rtn
=
abs
(
interval
[
1
]
-
interval
[
0
])
//
2
rng
=
sensor
.
ranges
[
test_rtn
]
theta_sense
=
sensor
.
rayBearing
(
test_rtn
)
rng
=
sensor
.
ranges
[
interval
[
2
]]
theta_sense
=
sensor
.
rayBearing
(
interval
[
2
])
test_pt
=
\
rm
.
projectSensorReturnToWorld
(
state
,
self
.
_sensor_posit
,
\
rng
,
theta_sense
)
...
...
This diff is collapsed.
Click to expand it.
src/cs4313_utilities/robot.py
+
5
−
1
View file @
cb10e661
...
...
@@ -40,6 +40,7 @@ class SimpleRobot(object):
mapToOdomTF: ROS listener for map transforms
timer: ROS timer for control loop iteration
odomLock: lock object to prevent concurrent access to the odometry
laserLock: lock object to prevent concurrent access to the laser scan
Class methods:
spinOnce: runs a single iteration of the vehicle
'
s control loop
...
...
@@ -97,6 +98,8 @@ class SimpleRobot(object):
self
.
timer
=
rospy
.
Rate
(
10
)
self
.
cmdPub
=
rospy
.
Publisher
(
cmdTopic
,
geometry_msgs
.
Twist
,
queue_size
=
1
)
self
.
odomLock
=
threading
.
RLock
()
self
.
laserLock
=
threading
.
RLock
()
def
setControlConstants
(
self
,
newCaptureDist
=
1.5
,
newMaxXDot
=
1.0
,
\
newMaxThetaDot
=
0.77
,
newXCmdC1
=
2.0
,
newXCmdC2
=
1.0
,
\
...
...
@@ -123,7 +126,8 @@ class SimpleRobot(object):
'''
ROS callback for updating laser data upon receipt of new scan data
@param scanData: sensor_msgs/LaserScan object containing scan data
'''
self
.
laserData
.
update
(
scanData
)
with
self
.
laserLock
:
self
.
laserData
.
update
(
scanData
)
def
processGroundTruth
(
self
,
groundTruthData
):
...
...
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