Map¶
src.python_motion_planning.utils.environment.env.Map
¶
Bases: Env
Class for continuous 2-d map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x_range
|
int
|
x-axis range of enviroment |
required |
y_range
|
int
|
y-axis range of environmet |
required |
Source code in src\python_motion_planning\utils\environment\env.py
Python
class Map(Env):
"""
Class for continuous 2-d map.
Parameters:
x_range (int): x-axis range of enviroment
y_range (int): y-axis range of environmet
"""
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]
]
self.obs_rect = []
self.obs_circ = []
def update(self, boundary=None, obs_circ=None, obs_rect=None):
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.