Map¶
src.python_motion_planning.utils.environment.env.Map
¶
Bases: Env
Class for continuous 2-d map.
Source code in src\python_motion_planning\utils\environment\env.py
Python
class Map(Env):
"""
Class for continuous 2-d map.
"""
def __init__(self, x_range: int, y_range: int) -> None:
super().__init__(x_range, y_range)
self.boundary = None
self.obs_circ = None
self.obs_rect = None
self.init()
def init(self):
"""
Initialize map.
"""
x, y = self.x_range, self.y_range
# boundary of environment
self.boundary = [
[0, 0, 1, y],
[0, y, x, 1],
[1, 0, x, 1],
[x, 1, 1, y]
]
# user-defined obstacles
self.obs_rect = [
[14, 12, 8, 2],
[18, 22, 8, 3],
[26, 7, 2, 12],
[32, 14, 10, 2]
]
self.obs_circ = [
[7, 12, 3],
[46, 20, 2],
[15, 5, 2],
[37, 7, 3],
[37, 23, 3]
]
def update(self, boundary, obs_circ, obs_rect):
self.boundary = boundary if boundary else self.boundary
self.obs_circ = obs_circ if obs_circ else self.obs_circ
self.obs_rect = obs_rect if obs_rect else self.obs_rect
init()
¶
Initialize map.
Source code in src\python_motion_planning\utils\environment\env.py
Python
def init(self):
"""
Initialize map.
"""
x, y = self.x_range, self.y_range
# boundary of environment
self.boundary = [
[0, 0, 1, y],
[0, y, x, 1],
[1, 0, x, 1],
[x, 1, 1, y]
]
# user-defined obstacles
self.obs_rect = [
[14, 12, 8, 2],
[18, 22, 8, 3],
[26, 7, 2, 12],
[32, 14, 10, 2]
]
self.obs_circ = [
[7, 12, 3],
[46, 20, 2],
[15, 5, 2],
[37, 7, 3],
[37, 23, 3]
]