Datasets:

Modalities:
Image
Size:
< 1K
ArXiv:
Libraries:
Datasets
File size: 9,809 Bytes
a71ca3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# :material-silverware-fork-knife: **BEHAVIOR Tasks**

[`BehaviorTask`](../reference/tasks/behavior_task.md) represents a family of **1000 long-horizon household activities** that humans benefit the most from robots' help based on our survey results.

## Getting Started

BDDL (BEHAVIOR Domain Definition Language) is automatically installed when you follow the [standard BEHAVIOR installation guide](../getting_started/installation.md). This section is only needed if you want to customize or edit task definitions.

### Installing BDDL for Customization (Optional)

If you want to modify or create new task definitions, you'll need to install the BDDL repository in development mode:

1. **Clone the repository:**
   ```bash
   git clone https://github.com/StanfordVL/bddl.git
   ```

2. **Install the package:**
   ```bash
   conda activate behavior
   cd bddl
   pip install -e .
   ```

3. **Verify installation:**
   ```python
   >>> import bddl; print(bddl)
   <module 'bddl' from '/path/to/BDDL/bddl/__init__.py'>
   ```

This should now point to your local `bddl` repo, instead of the PyPI version, giving you full editing capabilities.

## Task Library

### Where to Find Tasks

All 1000 activities are defined using **BDDL** (BEHAVIOR Domain Definition Language), specifically designed for household robotics tasks.

- **Local Files:** [`bddl/activity_definitions`](https://github.com/StanfordVL/bddl/tree/master/bddl/activity_definitions) folder
- **Online Browser:** [BEHAVIOR Knowledgebase](https://behavior.stanford.edu/knowledgebase/tasks) for interactive exploration

### Task Structure

Every BEHAVIOR task consists of three main components:

#### 1. Objects
Each line represents a [**WordNet**](https://wordnet.princeton.edu/) synset of required objects.

**Example:**
```yaml
candle.n.01_1 candle.n.01_2 candle.n.01_3 candle.n.01_4 - candle.n.01
```
This means four objects belonging to the `candle.n.01` synset are needed.

#### 2. Initial Conditions
Ground predicates that define the world state when the task begins.

**Example:**
```yaml
(ontop candle.n.01_1 table.n.02_1)
```
The first candle starts on top of the first table.

#### 3. Goal Conditions
Predicates and logical blocks that must be satisfied for task completion.

**Example:**
```yaml
(inside ?candle.n.01 ?wicker_basket.n.01)
```
All candles must end up inside wicker baskets.

### Complete Task Example

Here's a full task definition for assembling gift baskets:

```yaml
(define (problem assembling_gift_baskets-0)
    (:domain omnigibson)

    (:objects
        wicker_basket.n.01_1 wicker_basket.n.01_2 wicker_basket.n.01_3 wicker_basket.n.01_4 - wicker_basket.n.01
        floor.n.01_1 - floor.n.01
        candle.n.01_1 candle.n.01_2 candle.n.01_3 candle.n.01_4 - candle.n.01
        butter_cookie.n.01_1 butter_cookie.n.01_2 butter_cookie.n.01_3 butter_cookie.n.01_4 - butter_cookie.n.01
        swiss_cheese.n.01_1 swiss_cheese.n.01_2 swiss_cheese.n.01_3 swiss_cheese.n.01_4 - swiss_cheese.n.01
        bow.n.08_1 bow.n.08_2 bow.n.08_3 bow.n.08_4 - bow.n.08
        table.n.02_1 table.n.02_2 - table.n.02
        agent.n.01_1 - agent.n.01
    )
    
    (:init 
        (ontop wicker_basket.n.01_1 floor.n.01_1) 
        (ontop wicker_basket.n.01_2 floor.n.01_1) 
        (ontop wicker_basket.n.01_3 floor.n.01_1) 
        (ontop wicker_basket.n.01_4 floor.n.01_1) 
        (ontop candle.n.01_1 table.n.02_1) 
        (ontop candle.n.01_2 table.n.02_1) 
        (ontop candle.n.01_3 table.n.02_1) 
        (ontop candle.n.01_4 table.n.02_1) 
        (ontop butter_cookie.n.01_1 table.n.02_1) 
        (ontop butter_cookie.n.01_2 table.n.02_1) 
        (ontop butter_cookie.n.01_3 table.n.02_1) 
        (ontop butter_cookie.n.01_4 table.n.02_1) 
        (ontop swiss_cheese.n.01_1 table.n.02_2) 
        (ontop swiss_cheese.n.01_2 table.n.02_2) 
        (ontop swiss_cheese.n.01_3 table.n.02_2) 
        (ontop swiss_cheese.n.01_4 table.n.02_2) 
        (ontop bow.n.08_1 table.n.02_2) 
        (ontop bow.n.08_2 table.n.02_2) 
        (ontop bow.n.08_3 table.n.02_2) 
        (ontop bow.n.08_4 table.n.02_2) 
        (inroom floor.n.01_1 living_room) 
        (inroom table.n.02_1 living_room) 
        (inroom table.n.02_2 living_room) 
        (ontop agent.n.01_1 floor.n.01_1)
    )
    
    (:goal 
        (and 
            (forpairs 
                (?wicker_basket.n.01 - wicker_basket.n.01) 
                (?candle.n.01 - candle.n.01) 
                (inside ?candle.n.01 ?wicker_basket.n.01)
            ) 
            (forpairs 
                (?wicker_basket.n.01 - wicker_basket.n.01) 
                (?swiss_cheese.n.01 - swiss_cheese.n.01) 
                (inside ?swiss_cheese.n.01 ?wicker_basket.n.01)
            ) 
            (forpairs 
                (?wicker_basket.n.01 - wicker_basket.n.01) 
                (?butter_cookie.n.01 - butter_cookie.n.01) 
                (inside ?butter_cookie.n.01 ?wicker_basket.n.01)
            ) 
            (forpairs 
                (?wicker_basket.n.01 - wicker_basket.n.01) 
                (?bow.n.08 - bow.n.08) 
                (inside ?bow.n.08 ?wicker_basket.n.01)
            )
        )
    )
)
```

## Working with Tasks

### Sampling New Task Instances

Generate fresh instances of existing tasks with randomized elements for variety and robustness testing.

**Example: Sampling a wood floor laying task**

```python
import omnigibson as og

cfg = {
    "scene": {
        "type": "InteractiveTraversableScene",
        "scene_model": "Rs_int",
    },
    "robots": [
        {
            "type": "Fetch",
            "obs_modalities": ["rgb"],
            "default_arm_pose": "diagonal30",
            "default_reset_mode": "tuck",
        },
    ],
    "task": {
        "type": "BehaviorTask",
        "activity_name": "laying_wood_floors",  # Task name
        "activity_definition_id": 0,           # Problem variant
        "activity_instance_id": 0,             # Instance number
        "online_object_sampling": True,        # Enable sampling
    },
}

env = og.Environment(configs=cfg)
```

Each sampling run produces different variations:

- **Object Categories:** High-level synsets sample different specific types (e.g., `fruit.n.01` → apple, banana, orange)
- **Object Models:** Same categories use different 3D models with varying shapes and colors
- **Object Poses:** Spatial arrangements vary while satisfying constraints

### Sampling Challenges

Sampling can fail for various reasons - this is normal behavior:

| Failure Type | Description |
|--------------|-------------|
| **Missing Rooms** | Required room type doesn't exist in the scene |
| **No Valid Objects** | Cannot find appropriate scene objects for the task |
| **Physical Constraints** | Cannot satisfy initial conditions (e.g., objects too large) |

### Saving Task Instances

Once successfully sampled, preserve the configuration for reuse:

```python
# Save the current task instance
env.task.save_task()
```

Default save location:
```
<gm.DATA_PATH>/behavior-1k-assets/scenes/<SCENE_MODEL>/json/<scene_model>_task_{activity_name}_{activity_definition_id}_{activity_instance_id}_template.json
```

## Loading Pre-sampled Tasks

### Using Existing Instances

For consistent, reproducible experiments, load pre-sampled task instances from the dataset. Our publicly available dataset includes **exactly 1 pre-sampled instance** of all 1000 BEHAVIOR tasks.

**Example: Loading a pre-sampled task**

```python
import omnigibson as og

cfg = {
    "scene": {
        "type": "InteractiveTraversableScene",
        "scene_model": "Rs_int",
    },
    "robots": [
        {
            "type": "Fetch",
            "obs_modalities": ["rgb"],
            "default_arm_pose": "diagonal30",
            "default_reset_mode": "tuck",
        },
    ],
    "task": {
        "type": "BehaviorTask",
        "activity_name": "laying_wood_floors",
        "activity_definition_id": 0,
        "activity_instance_id": 0,
        "online_object_sampling": False,  # Load pre-sampled
    },
}

env = og.Environment(configs=cfg)
```

### Finding Pre-sampled Tasks

Discover available pre-sampled task instances in your dataset:

```bash
ls -l <gm.DATA_PATH>/*/scenes/*/json/*task*
```

**Recommendation:** Set `online_object_sampling=False` to load the stable, pre-sampled task instances for consistent evaluation and comparison.

## Creating Custom Tasks

### Step-by-Step Process

1. **Create task directory:**
   ```bash
   mkdir bddl/activity_definitions/my_new_task
   ```

2. **Create task definition file:**
   ```bash
   touch bddl/activity_definitions/my_new_task/problem0.bddl
   ```

3. **Define task components:**
   - Specify required objects (`:objects`)
   - Set initial conditions (`:init`) 
   - Define goal conditions (`:goal`)

4. **Validate compatibility:**
   ```bash
   cd bddl
   python tests/bddl_tests.py batch_verify
   python tests/tm_tests.py
   ```

5. **Test your custom task:**
   ```python
   cfg = {
       # ... standard configuration ...
       "task": {
           "type": "BehaviorTask",
           "activity_name": "my_new_task",  # Your custom task
           "activity_definition_id": 0,
           "activity_instance_id": 0,
           "online_object_sampling": True,
       },
   }
   
   env = og.Environment(configs=cfg)
   ```

### Activity Identification

Tasks are uniquely identified by three parameters:

- **`activity_name`** - The task type (e.g., "laying_wood_floors")
- **`activity_definition_id`** - Problem variant within the task (usually 0)
- **`activity_instance_id`** - Specific instance number for the sampled configuration

You now have the complete toolkit for working with BEHAVIOR tasks! Start by exploring the 1000 pre-defined activities, then create your own custom household robotics challenges.