Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multiparty_interaction_simulator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor 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
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
Spring
WP6_Robot_Behavior
multiparty_interaction_simulator
Commits
c8b77567
Commit
c8b77567
authored
1 year ago
by
SANCHEZ Victor
Browse files
Options
Downloads
Patches
Plain Diff
modif mapping with imported map
parent
dd9b126c
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
mpi_sim/components/occupany_grid_mapping.py
+38
-16
38 additions, 16 deletions
mpi_sim/components/occupany_grid_mapping.py
with
38 additions
and
16 deletions
mpi_sim/components/occupany_grid_mapping.py
+
38
−
16
View file @
c8b77567
...
@@ -24,6 +24,7 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -24,6 +24,7 @@ class OccupancyGridMapping(SensorComponent):
dc
.
imported_global_map_path
=
False
# Import Global map - path
dc
.
imported_global_map_path
=
False
# Import Global map - path
dc
.
imported_global_map_resolution
=
False
# Import Global map - resolution
dc
.
imported_global_map_resolution
=
False
# Import Global map - resolution
dc
.
imported_global_map_area
=
False
# Import Global map - area (can either be a tuple of a function is the area is not squared)
dc
.
imported_global_map_area
=
False
# Import Global map - area (can either be a tuple of a function is the area is not squared)
dc
.
imported_global_map_px_coord_center
=
None
return
dc
return
dc
...
@@ -103,7 +104,7 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -103,7 +104,7 @@ class OccupancyGridMapping(SensorComponent):
self
.
_global_map_area
=
self
.
config
.
imported_global_map_area
self
.
_global_map_area
=
self
.
config
.
imported_global_map_area
self
.
state
.
is_global_map_initialized
=
True
#The global map is initialized and doesn't need to be updated
self
.
state
.
is_global_map_initialized
=
True
#The global map is initialized and doesn't need to be updated
if
isinstance
(
self
.
config
.
import_global_map
,
str
):
if
isinstance
(
self
.
config
.
import
ed
_global_map
_path
,
str
):
imported_global_map
=
np
.
load
(
file
=
self
.
config
.
imported_global_map_path
)
imported_global_map
=
np
.
load
(
file
=
self
.
config
.
imported_global_map_path
)
self
.
state
.
global_map
=
mpi_sim
.
utils
.
OccupancyGridMap
(
self
.
state
.
global_map
=
mpi_sim
.
utils
.
OccupancyGridMap
(
...
@@ -115,7 +116,7 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -115,7 +116,7 @@ class OccupancyGridMapping(SensorComponent):
self
.
_global_map_shape
=
np
.
shape
(
imported_global_map
)
self
.
_global_map_shape
=
np
.
shape
(
imported_global_map
)
else
:
else
:
raise
UserWarning
(
'
The parameter
\'
import_global_map
\'
should be a type str but it is {}
'
.
format
(
type
(
self
.
config
.
import_global_map
)))
raise
UserWarning
(
'
The parameter
\'
import
ed
_global_map
_path
\'
should be a type str but it is {}
'
.
format
(
type
(
self
.
config
.
import
ed
_global_map
_path
)))
self
.
_local_map_area
=
((
-
self
.
config
.
depth
,
self
.
config
.
depth
),
(
-
self
.
config
.
depth
,
self
.
config
.
depth
))
self
.
_local_map_area
=
((
-
self
.
config
.
depth
,
self
.
config
.
depth
),
(
-
self
.
config
.
depth
,
self
.
config
.
depth
))
local_map_length
=
int
((
self
.
config
.
depth
/
self
.
_resolution
)
*
2
)
local_map_length
=
int
((
self
.
config
.
depth
/
self
.
_resolution
)
*
2
)
...
@@ -144,28 +145,49 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -144,28 +145,49 @@ class OccupancyGridMapping(SensorComponent):
def
update_global_map
(
self
):
def
update_global_map
(
self
):
self
.
state
.
global_map
=
mpi_sim
.
utils
.
create_occupancy_grid_map
(
if
not
self
.
config
.
imported_global_map_path
:
self
.
simulation
,
self
.
state
.
global_map
=
mpi_sim
.
utils
.
create_occupancy_grid_map
(
area
=
self
.
_global_map_area
,
self
.
simulation
,
resolution
=
self
.
_resolution
,
area
=
self
.
_global_map_area
,
object_filter
=
self
.
config
.
object_filter
,
resolution
=
self
.
_resolution
,
transform
=
self
.
config
.
transform
object_filter
=
self
.
config
.
object_filter
,
)
transform
=
self
.
config
.
transform
)
else
:
imported_global_map
=
np
.
load
(
file
=
self
.
config
.
imported_global_map_path
)
self
.
state
.
global_map
=
mpi_sim
.
utils
.
OccupancyGridMap
(
map
=
imported_global_map
,
area
=
self
.
_global_map_area
,
resolution
=
self
.
_resolution
)
return
self
.
state
.
global_map
.
map
return
self
.
state
.
global_map
.
map
def
update_local_map
(
self
):
def
update_local_map
(
self
):
if
self
.
state
.
global_map
is
None
:
if
self
.
state
.
global_map
is
None
:
self
.
update_global_map
()
self
.
update_global_map
()
if
not
self
.
config
.
imported_global_map_path
:
self
.
state
.
local_map
=
mpi_sim
.
utils
.
create_local_perspective_occupancy_grid_map
(
self
.
state
.
local_map
=
mpi_sim
.
utils
.
create_local_perspective_occupancy_grid_map
(
global_map
=
self
.
state
.
global_map
,
global_map
=
self
.
state
.
global_map
,
position
=
self
.
object
.
position
,
position
=
self
.
object
.
position
,
orientation
=
constraint_angle
(
self
.
object
.
orientation
),
orientation
=
constraint_angle
(
self
.
object
.
orientation
),
depth
=
self
.
config
.
depth
,
depth
=
self
.
config
.
depth
,
)
)
else
:
# Same but we need to relocate the position from the center of the imported room
coord_of_imported_map_center
=
mpi_sim
.
utils
.
transform_map_coordinate_to_position
(
map_coordinate
=
self
.
config
.
imported_global_map_px_coord_center
,
map_area
=
self
.
config
.
imported_global_map_area
,
map_resolution
=
self
.
config
.
imported_global_map_resolution
)
self
.
state
.
local_map
=
mpi_sim
.
utils
.
create_local_perspective_occupancy_grid_map
(
global_map
=
self
.
state
.
global_map
,
position
=
self
.
object
.
position
+
coord_of_imported_map_center
,
orientation
=
constraint_angle
(
self
.
object
.
orientation
),
depth
=
self
.
config
.
depth
,
)
return
self
.
state
.
local_map
.
map
return
self
.
state
.
local_map
.
map
...
...
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