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
83558624
Commit
83558624
authored
2 months ago
by
rachelmoan
Browse files
Options
Downloads
Patches
Plain Diff
return the tree when planning with RRT/RRT*
parent
2da93a5a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
guided_mrmp/planners/singlerobot/RRT.py
+13
-6
13 additions, 6 deletions
guided_mrmp/planners/singlerobot/RRT.py
guided_mrmp/planners/singlerobot/RRTStar.py
+2
-2
2 additions, 2 deletions
guided_mrmp/planners/singlerobot/RRTStar.py
with
15 additions
and
8 deletions
guided_mrmp/planners/singlerobot/RRT.py
+
13
−
6
View file @
83558624
...
...
@@ -7,13 +7,17 @@ import numpy as np
from
guided_mrmp.utils
import
Node
,
Env
class
RRT
:
def
__init__
(
self
,
env
,
s_start
,
s_goal
,
step_len
,
goal_sample_rate
,
iter_max
):
def
__init__
(
self
,
env
,
s_start
,
s_goal
,
step_len
,
goal_sample_rate
,
iter_max
,
sampled_vertices
=
None
):
self
.
s_start
=
Node
(
s_start
,
s_start
,
0
,
0
)
self
.
s_goal
=
Node
(
s_goal
,
s_goal
,
0
,
0
)
self
.
step_len
=
step_len
self
.
goal_sample_rate
=
goal_sample_rate
self
.
iter_max
=
iter_max
self
.
sampled_vertices
=
[
self
.
s_start
]
if
sampled_vertices
is
None
:
self
.
sampled_vertices
=
[
self
.
s_start
]
else
:
self
.
sampled_vertices
=
sampled_vertices
self
.
env
=
env
# self.plotting = Plotting(self.env)
...
...
@@ -141,6 +145,7 @@ class RRT:
dx
=
node_end
.
x
-
node_start
.
x
dy
=
node_end
.
y
-
node_start
.
y
return
math
.
hypot
(
dx
,
dy
),
math
.
atan2
(
dy
,
dx
)
def
extractPath
(
self
,
closed_set
):
"""
Extract the path based on the CLOSED set.
...
...
@@ -161,7 +166,9 @@ class RRT:
path
.
append
(
node
.
current
)
return
cost
,
path
# return the cost, path, and the tree of the sampled vertices
return
cost
,
path
,
closed_set
def
get_distance_and_angle
(
self
,
node_start
,
node_end
):
dx
=
node_end
.
x
-
node_start
.
x
...
...
@@ -193,16 +200,16 @@ class RRT:
return
self
.
extractPath
(
self
.
sampled_vertices
)
return
0
,
None
return
0
,
None
,
None
def
run
(
self
):
cost
,
path
=
self
.
plan
()
cost
,
path
,
tree
=
self
.
plan
()
# self.plotting.animation([path], "RRT", cost, self.sampled_vertices)
# print(f"num of sampled vertices = {len(self.sampled_vertices)}")
# for node in self.sampled_vertices:
# print(f"{node.current}")
return
path
return
path
,
tree
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
guided_mrmp/planners/singlerobot/RRTStar.py
+
2
−
2
View file @
83558624
...
...
@@ -4,8 +4,8 @@ RRT*
from
guided_mrmp.planners.singlerobot.RRT
import
RRT
class
RRTStar
(
RRT
):
def
__init__
(
self
,
env
,
s_start
,
s_goal
,
step_len
,
goal_sample_rate
,
iter_max
,
r
):
super
().
__init__
(
env
,
s_start
,
s_goal
,
step_len
,
goal_sample_rate
,
iter_max
)
def
__init__
(
self
,
env
,
s_start
,
s_goal
,
step_len
,
goal_sample_rate
,
iter_max
,
r
,
sampled_vertices
=
None
):
super
().
__init__
(
env
,
s_start
,
s_goal
,
step_len
,
goal_sample_rate
,
iter_max
,
sampled_vertices
=
None
)
self
.
r
=
r
self
.
name
=
"
RRT*
"
...
...
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