-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
75 lines (68 loc) · 1.68 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import numpy as np
from mpc.agent import EgoAgent
from mpc.dynamic_obstacle import DynamicObstacle
from mpc.environment import LocalEnvironment
from mpc.geometry import Circle, Ellipsoid, Rectangle
from mpc.obstacle import StaticObstacle
agent = EgoAgent(
id=1,
initial_position=(8, -20),
initial_orientation=np.pi / 2,
horizon=30,
use_warm_start=True,
)
static_obstacle_rectangle = StaticObstacle(
id=1,
geometry=Rectangle(height=2, width=8),
position=(-4, 10),
)
static_obstacle_rectangle_2 = StaticObstacle(
id=2,
geometry=Rectangle(height=2, width=8),
position=(8, 10),
)
static_obstacle_ellipse = StaticObstacle(
id=2,
geometry=Ellipsoid.from_rectangle(Rectangle(height=2, width=8)),
position=(8, 10),
)
static_obstacle_circle = StaticObstacle(
id=3,
geometry=Circle(radius=1),
position=(6, 10),
)
static_obstacle_circle_2 = StaticObstacle(
id=3,
geometry=Circle(radius=1),
position=(8, 10),
)
static_obstacle_circle_3 = StaticObstacle(
id=3,
geometry=Circle(radius=1),
position=(10, 10),
)
dynamic_obstacle = DynamicObstacle(
id=4,
position=(13, 12.5),
orientation=np.deg2rad(-90),
goal_position=(3, -12.5),
goal_orientation=np.deg2rad(90),
horizon=30,
)
environment = LocalEnvironment(
agent=agent,
static_obstacles=[
# static_obstacle_rectangle,
# static_obstacle_rectangle_2,
# static_obstacle_ellipse,
# static_obstacle_circle,
# static_obstacle_circle_2,
# static_obstacle_circle_3,
],
dynamic_obstacles=[
dynamic_obstacle,
],
waypoints=[((8, 15), np.deg2rad(90))],
save_video=True,
)
environment.loop()