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
Show more breadcrumbs
Spring
WP6_Robot_Behavior
multiparty_interaction_simulator
Commits
193720d9
Commit
193720d9
authored
1 year ago
by
SANCHEZ Victor
Browse files
Options
Downloads
Patches
Plain Diff
adding noisy map in occupanct grid mapping
parent
7495db24
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/occupancy_grid_mapping.py
+40
-0
40 additions, 0 deletions
mpi_sim/components/occupancy_grid_mapping.py
with
40 additions
and
0 deletions
mpi_sim/components/occupancy_grid_mapping.py
+
40
−
0
View file @
193720d9
...
@@ -25,6 +25,8 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -25,6 +25,8 @@ class OccupancyGridMapping(SensorComponent):
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
dc
.
imported_global_map_px_coord_center
=
None
dc
.
position_noise
=
0
dc
.
orientation_noise
=
0
return
dc
return
dc
...
@@ -62,6 +64,14 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -62,6 +64,14 @@ class OccupancyGridMapping(SensorComponent):
return
None
return
None
else
:
else
:
return
self
.
update_local_map
()
return
self
.
update_local_map
()
@property
def
local_map_noisy
(
self
):
r
"""
Get the noisy version of the local occupancy grid map that is centered and oriented around the object of the component.
"""
if
self
.
state
.
local_map_noisy
is
None
:
return
None
else
:
return
self
.
update_noisy_local_map
()
@property
@property
...
@@ -135,6 +145,12 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -135,6 +145,12 @@ class OccupancyGridMapping(SensorComponent):
resolution
=
self
.
_resolution
resolution
=
self
.
_resolution
)
)
self
.
state
.
local_map_noisy
=
mpi_sim
.
utils
.
OccupancyGridMap
(
map
=
np
.
zeros
(
self
.
_local_map_shape
),
area
=
None
,
resolution
=
self
.
_resolution
)
def
_add_to_simulation
(
self
):
def
_add_to_simulation
(
self
):
...
@@ -195,6 +211,29 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -195,6 +211,29 @@ class OccupancyGridMapping(SensorComponent):
)
)
return
self
.
state
.
local_map
.
map
return
self
.
state
.
local_map
.
map
def
update_noisy_local_map
(
self
):
if
self
.
state
.
global_map
is
None
:
self
.
update_global_map
()
if
not
self
.
config
.
imported_global_map_path
:
self
.
state
.
local_map_noisy
=
mpi_sim
.
utils
.
create_local_perspective_occupancy_grid_map
(
global_map
=
self
.
state
.
global_map
,
position
=
self
.
object
.
position
+
self
.
config
.
position_noise
*
np
.
array
([
np
.
random
.
uniform
(
low
=-
1
,
high
=
1
),
np
.
random
.
uniform
(
low
=-
1
,
high
=
1
)]),
orientation
=
constraint_angle
(
self
.
object
.
orientation
)
+
self
.
config
.
orientation_noise
*
np
.
random
.
uniform
(
low
=-
1
,
high
=
1
),
depth
=
self
.
config
.
depth
,
)
else
:
# Same but we need to relocate the position from the center of the imported room
self
.
state
.
local_map_noisy
=
mpi_sim
.
utils
.
create_local_perspective_occupancy_grid_map
(
global_map
=
self
.
state
.
global_map
,
position
=
self
.
object
.
position
+
self
.
config
.
position_noise
*
np
.
array
([
np
.
random
.
uniform
(
low
=-
1
,
high
=
1
),
np
.
random
.
uniform
(
low
=-
1
,
high
=
1
)]),
orientation
=
constraint_angle
(
np
.
pi
/
2
+
self
.
object
.
orientation
)
+
self
.
config
.
orientation_noise
*
np
.
random
.
uniform
(
low
=-
1
,
high
=
1
),
depth
=
self
.
config
.
depth
,
from_given_center
=
self
.
config
.
imported_global_map_px_coord_center
)
return
self
.
state
.
local_map_noisy
.
map
def
_step
(
self
):
def
_step
(
self
):
...
@@ -203,3 +242,4 @@ class OccupancyGridMapping(SensorComponent):
...
@@ -203,3 +242,4 @@ class OccupancyGridMapping(SensorComponent):
self
.
state
.
is_global_map_initialized
=
True
self
.
state
.
is_global_map_initialized
=
True
if
self
.
config
.
update_local_map_automatically
:
if
self
.
config
.
update_local_map_automatically
:
self
.
update_local_map
()
self
.
update_local_map
()
self
.
update_noisy_local_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