File size: 2,190 Bytes
06b3545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Global configuration: CLEVRER-style attributes, palette and physics constants."""

# ---------------------------------------------------------------- attributes
# The 8 CLEVRER colors (RGB, roughly matched to CLEVRER's palette).
COLORS = {
    "gray":   (144, 144, 148),
    "red":    (196,  44,  38),
    "blue":   ( 46,  71, 190),
    "green":  ( 62, 131,  55),
    "brown":  ( 96,  58,  33),
    "purple": (110,  46, 150),
    "cyan":   ( 63, 156, 158),
    "yellow": (196, 150,  18),
}
COLOR_NAMES = list(COLORS.keys())

SHAPES = ["cube", "sphere", "cylinder"]
MATERIALS = ["rubber", "metal"]
SIZES = ["small", "large"]

# physical radius range for each size class (world units)
SIZE_RADIUS = {"small": (0.14, 0.20), "large": (0.26, 0.34)}

# ---------------------------------------------------------------- world
WORLD_HALF = 2.0      # arena is [-WORLD_HALF, WORLD_HALF]^2 (top-down view)
SPAWN_HALF = 1.55     # objects spawn inside [-SPAWN_HALF, SPAWN_HALF]^2

# ---------------------------------------------------------------- physics
FRAME_DT = 1.0 / 25.0            # one rendered frame = 40 ms (25 fps)
SUBSTEPS = 5                     # physics substeps per rendered frame
SUB_DT = FRAME_DT / SUBSTEPS     # physics integration step

SPEED_RANGE = (0.7, 1.7)         # initial speed range for moving objects
RESTITUTION = 0.95               # object-object bounciness
WALL_RESTITUTION = 0.90          # object-wall bounciness
DRAG = 0.9992                    # velocity decay per substep (tiny air drag)

DENSITY = {"rubber": 1.0, "metal": 2.5}

MOVE_THRESH = 0.12               # |v| above this counts as "moving"
MIN_RUN_FRAMES = 4               # a motion segment must last this many frames
MIN_EVENT_GAP_FRAMES = 6         # same-pair contacts within this window = 1 event
CAUSE_WINDOW_FRAMES = 4          # collision this close to a start-of-motion explains it

# ---------------------------------------------------------------- probe (gym agent)
PROBE_COLOR = "gray"
PROBE_SIZE = "medium"
PROBE_RADIUS = 0.22
PROBE_IMPULSE = 1.1              # delta-v applied to the probe ball per action
ACTION_LABELS = ["noop", "push_east", "push_north", "push_west", "push_south"]