-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample_scenarios.py
More file actions
62 lines (46 loc) · 2.58 KB
/
Copy pathexample_scenarios.py
File metadata and controls
62 lines (46 loc) · 2.58 KB
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
from sailenv import Vector3
from sailenv.dynamics.uniform_movement_random_bounce import UniformMovementRandomBounce
from sailenv.dynamics.waypoints import Waypoint, CatmullWaypoints, LinearWaypoints
from sailenv.generators.object import Object
from sailenv.generators.scenario import Scenario, Frustum
from sailenv.generators.timings import AllTogetherTimings, WaitUntilCompleteTimings, DictTimings
def flying_cylinder_empty(agent_pos):
waypoints_offsets = [
Waypoint(Vector3(0., 0., 4.), Vector3(0., 0., 0.)),
Waypoint(Vector3(0., 2., 4.), Vector3(90., 0., 0.)),
Waypoint(Vector3(3., 2., -4.), Vector3(90., 90., 0.)),
Waypoint(Vector3(3., 1., -7.), Vector3(90., 90., 90.)),
Waypoint(Vector3(-5., 1., 7.), Vector3(90., 90., 180.)),
]
waypoints = [Waypoint(offset.position + agent_pos, offset.rotation) for offset in waypoints_offsets]
dynamic1 = CatmullWaypoints(waypoints=waypoints, total_time=10.)
objects = [
Object("cylinder", "Cylinder", Vector3(0, 0, 2), Vector3(0, 0, 0), dynamic1),
]
return Scenario("object_view/scene", objects)
def room_01():
waypoints = [
Waypoint(Vector3(0.5, 1.4, 0.5), Vector3(0., 0., 0.)),
Waypoint(Vector3(0.3, 1., -1.), Vector3(90., 0., 0.)),
Waypoint(Vector3(-0.4, 0.6, 0.5), Vector3(90., 90., 0.)),
Waypoint(Vector3(-1.5, 1.8, -1.0), Vector3(90., 90., 90.)),
Waypoint(Vector3(0.5, 1.4, -1.0), Vector3(90., 90., 180.))
]
dynamic = CatmullWaypoints(waypoints=waypoints)
objects = [
Object("racket", "Tennis Racket 01", Vector3(0.5, 1.4, 0.5), Vector3(0., 0., 0.), dynamic)
]
timings = WaitUntilCompleteTimings(1.5)
scenario = Scenario("room_01/scene", objects, timings, Frustum(False, 20.))
return scenario
def all_together(agent_pos):
dynamic1 = UniformMovementRandomBounce(seed=32, speed=0.5, start_direction=Vector3(0, 5, 2))
dynamic2 = UniformMovementRandomBounce(seed=32, speed=0.5, start_direction=Vector3(2, 3, 1))
dynamic3 = UniformMovementRandomBounce(seed=32, speed=0.5, start_direction=Vector3(4, 1, 2))
objects = [
Object("chair", "Chair 01", agent_pos + Vector3(0.5, 0., 2.), Vector3(0., 0., 0.), dynamic1, frustum_limited=True),
Object("pillow", "Pillow 01", agent_pos + Vector3(0., -0.5, 2.), Vector3(0., 0., 0.), dynamic2, frustum_limited=True),
Object("dish", "Dish 01", agent_pos + Vector3(-0.5, 0.5, 2.), Vector3(0., 0., 0.), dynamic3, frustum_limited=True),
]
timings = AllTogetherTimings(0.75)
return Scenario("room_02/scene", objects, timings, Frustum(True, 2.5))