mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-01-12 23:58:04 -05:00
* feat: add ElasticBands * feat: Elastic Bands update * feat: ElasticBands update * feat: ElasticBands add test * feat: ElasticBands reduce occupation * fix: ElasticBands test * feat: ElasticBands remove tangential component * feat: Elastic Bands update * feat: Elastic Bands doc * feat: Elastic Bands update * feat: ElasticBands update
24 lines
788 B
Python
24 lines
788 B
Python
import conftest
|
|
import numpy as np
|
|
from PathPlanning.ElasticBands.elastic_bands import ElasticBands
|
|
|
|
|
|
def test_1():
|
|
path = np.load("PathPlanning/ElasticBands/path.npy")
|
|
obstacles_points = np.load("PathPlanning/ElasticBands/obstacles.npy")
|
|
obstacles = np.zeros((500, 500))
|
|
for x, y in obstacles_points:
|
|
size = 30 # Side length of the square
|
|
half_size = size // 2
|
|
x_start = max(0, x - half_size)
|
|
x_end = min(obstacles.shape[0], x + half_size)
|
|
y_start = max(0, y - half_size)
|
|
y_end = min(obstacles.shape[1], y + half_size)
|
|
obstacles[x_start:x_end, y_start:y_end] = 1
|
|
elastic_bands = ElasticBands(path, obstacles)
|
|
elastic_bands.update_bubbles()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
conftest.run_this_test(__file__)
|