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
57a1c38e
Commit
57a1c38e
authored
4 months ago
by
rachelmoan
Browse files
Options
Downloads
Patches
Plain Diff
add library initialization to main
parent
b83439cd
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
guided_mrmp/main.py
+31
-5
31 additions, 5 deletions
guided_mrmp/main.py
with
31 additions
and
5 deletions
guided_mrmp/main.py
+
31
−
5
View file @
57a1c38e
...
@@ -10,9 +10,10 @@ from guided_mrmp.planners import RRTStar
...
@@ -10,9 +10,10 @@ from guided_mrmp.planners import RRTStar
from
guided_mrmp.planners.db_guided_mrmp
import
GuidedMRMP
from
guided_mrmp.planners.db_guided_mrmp
import
GuidedMRMP
from
guided_mrmp.simulator
import
Simulator
from
guided_mrmp.simulator
import
Simulator
from
guided_mrmp.utils.library
import
Library
class_names_di
s
t
=
{
class_
function_
names_di
c
t
=
{
'
Roomba
'
:
Roomba
,
'
Roomba
'
:
Roomba
# 'RRT': RRT(),
# 'RRT': RRT(),
# 'RRTStar': RRTStar(),
# 'RRTStar': RRTStar(),
}
}
...
@@ -91,9 +92,30 @@ def initialize_robots(starts, goals, dynamics_models, radii, target_v, env):
...
@@ -91,9 +92,30 @@ def initialize_robots(starts, goals, dynamics_models, radii, target_v, env):
return
robots
return
robots
def
initialize_libraries
(
library_fnames
=
[
"
guided_mrmp/database/2x3_library
"
,
"
guided_mrmp/database/3x3_library
"
,
"
guided_mrmp/database/5x2_library
"
]):
"""
Load the 2x3, 3x3, and 2x5 libraries. Store them in self.lib-x-
Inputs:
library_fnames - the folder containing the library files
"""
# Create each of the libraries
print
(
f
"
Loading libraries. This usually takes about 10 seconds...
"
)
lib_2x3
=
Library
(
library_fnames
[
0
])
lib_2x3
.
read_library_from_file
()
lib_3x3
=
Library
(
library_fnames
[
1
])
lib_3x3
.
read_library_from_file
()
lib_2x5
=
Library
(
library_fnames
[
2
])
lib_2x5
.
read_library_from_file
()
return
[
lib_2x3
,
lib_3x3
,
lib_2x5
]
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
# Load the settings
# Load the settings
settings
=
load_settings
(
"
settings_files/settings
_mpc
.yaml
"
)
settings
=
load_settings
(
"
settings_files/settings.yaml
"
)
set_python_seed
(
1123
)
set_python_seed
(
1123
)
# set_python_seed(11235813)
# set_python_seed(11235813)
...
@@ -112,7 +134,7 @@ if __name__ == "__main__":
...
@@ -112,7 +134,7 @@ if __name__ == "__main__":
dynamics_models
=
[]
dynamics_models
=
[]
for
model
in
dynamics_models_st
:
for
model
in
dynamics_models_st
:
dynamics_models
.
append
(
class_names_di
s
t
[
model
]())
dynamics_models
.
append
(
class_
function_
names_di
c
t
[
model
]())
# Load and create the robots
# Load and create the robots
robot_starts
=
settings
[
'
robot_starts
'
]
robot_starts
=
settings
[
'
robot_starts
'
]
...
@@ -125,10 +147,14 @@ if __name__ == "__main__":
...
@@ -125,10 +147,14 @@ if __name__ == "__main__":
robots
=
initialize_robots
(
robot_starts
,
robot_goals
,
dynamics_models
,
robot_radii
,
target_v
,
env
)
robots
=
initialize_robots
(
robot_starts
,
robot_goals
,
dynamics_models
,
robot_radii
,
target_v
,
env
)
# Load the libraries
# libs = initialize_libraries()
libs
=
[
None
,
None
,
None
]
# Create the Guided MRMP policy
# Create the Guided MRMP policy
T
=
settings
[
'
prediction_horizon
'
]
T
=
settings
[
'
prediction_horizon
'
]
DT
=
settings
[
'
discretization_step
'
]
DT
=
settings
[
'
discretization_step
'
]
policy
=
GuidedMRMP
(
env
,
robots
,
dynamics_models
,
T
,
DT
,
settings
)
policy
=
GuidedMRMP
(
env
,
robots
,
dynamics_models
,
T
,
DT
,
libs
,
settings
)
# Create the simulator
# Create the simulator
scaling_factor
=
settings
[
'
simulator
'
][
'
scaling_factor
'
]
scaling_factor
=
settings
[
'
simulator
'
][
'
scaling_factor
'
]
...
...
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