Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
db-guided-mrmp
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rmoan2
db-guided-mrmp
Commits
89a0dfd2
Commit
89a0dfd2
authored
4 days ago
by
Adam Sitabkhan
Browse files
Options
Downloads
Patches
Plain Diff
Revised find_all_waiting_robots, queue iteration instead of recursion
parent
82ee7378
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
guided_mrmp/controllers/multi_path_tracking_db.py
+16
-13
16 additions, 13 deletions
guided_mrmp/controllers/multi_path_tracking_db.py
with
16 additions
and
13 deletions
guided_mrmp/controllers/multi_path_tracking_db.py
+
16
−
13
View file @
89a0dfd2
...
...
@@ -613,7 +613,7 @@ class MultiPathTrackerDB(MultiPathTracker):
else
:
# Discrete solver failed, resolve the conflict another way
if
waiting
:
# Choose all but one robot to "wait" (i.e. controls are 0)
c_wait
=
c
[
1
:]
c_wait
=
np
.
random
.
choice
(
c
,
len
(
c
)
-
1
,
replace
=
False
)
all_waiting_robots
.
extend
(
c_wait
)
else
:
...
...
@@ -665,24 +665,27 @@ class MultiPathTrackerDB(MultiPathTracker):
"""
Given a list of robots that have been marked as waiting, find all other robots
whose next state intersects with the waiting robots
'
current state. Those robots
should also be marked as waiting. This will need to be resursive since the robots
that are marked as waiting will also need to be checked for intersections with others
should also be marked as waiting.
params:
- waiting (list): list of robots that have already been marked as waiting
- x_mpcs (list): list of the next states of all robots
"""
# check if the next state of any of the robots intersects with the current state of the waiting robots
for
i
in
range
(
self
.
num_robots
):
if
i
in
waiting
:
continue
for
j
in
waiting
:
# print(f"x_mpc[i] = {x_mpc[i]}")
i_state
=
[
x_mpc
[
i
][
0
][
1
],
x_mpc
[
i
][
1
][
1
]]
if
np
.
linalg
.
norm
(
i_state
-
state
[
j
][:
2
])
<
2
*
self
.
radius
:
waiting
.
append
(
i
)
self
.
find_all_waiting_robots
(
waiting
,
x_mpc
)
break
# Init queue with all pairs of (i, j) where i is non-waiting and j is waiting
queue
=
[(
i
,
j
)
for
j
in
waiting
for
i
in
range
(
self
.
num_robots
)
if
i
not
in
waiting
]
while
queue
:
i
,
j
=
queue
.
pop
(
0
)
if
i
in
waiting
:
continue
# Case where i was originally non-waiting but has since been marked as waiting
i_next_state
=
x_mpc
[
i
][:
2
][
1
]
j_curr_state
=
state
[
j
][:
2
]
if
np
.
linalg
.
norm
(
i_next_state
-
j_curr_state
)
<
2
*
self
.
radius
:
waiting
.
append
(
i
)
# Set i to waiting and add all pairs of (i, k) to the queue for non-waiting k
for
k
in
range
(
self
.
num_robots
):
if
k
not
in
waiting
:
queue
.
append
((
k
,
i
))
return
waiting
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