Skip to content

Commit 89e7c11

Browse files
committed
updates to goal specification api logic
1 parent 5359a58 commit 89e7c11

20 files changed

+30
-45
lines changed

API.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,27 @@ The simulator API is implemented in [minos/lib/Simulator.py](lib/Simulator.py).
113113

114114
To specify a point as a goal (with radius r as a distance threshold):
115115
```
116-
{ 'position': [x, y, z], 'radius': r }
116+
{ 'type': 'position', 'position': [x, y, z], 'radius': r }
117117
```
118118
To specify object categories as goals and select a random instance of the category as the goal:
119119
```
120-
{ 'categories': ['arch', 'door'], 'select': 'random' }
120+
{ 'type': 'object', 'categories': ['arch', 'door'], 'select': 'random' }
121121
```
122-
To specify room types as goals and select a random room of the category as the goal:
122+
To specify room types as goals and select the random room of the category as the goal:
123123
```
124-
{ 'roomTypes': ['bedroom', 'bathroom'], 'select': 'random' }
124+
{ 'type': 'room', 'roomTypes': ['bedroom', 'bathroom'], 'select': 'random' }
125125
```
126126
To specify instances of a model id as a goal, and select the closest from start as the goal:
127127
```
128-
{ 'modelIds': ['3dw.abc...', '3dw.efg...'], 'select': 'closest' }
128+
{ 'type': 'object', 'modelIds': ['3dw.abc...', '3dw.efg...'], 'select': 'closest' }
129129
```
130130
To specify a specific object id as a goal:
131131
```
132-
{ 'objectIds': ['0_12'] }
132+
{ 'type': 'object', 'objectIds': ['0_12'] }
133133
```
134134
To specify a specific room id as the goal:
135135
```
136-
{ 'roomIds': ['0_1'] }
136+
{ 'type': 'room', 'roomIds': ['0_1'] }
137137
```
138138

139139
#### Navigation map

minos/config/envs/objectgoal_suncg_me.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'object_goal',
5-
'goal': {'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
5+
'goal': {'type': 'object', 'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
66
'measure_fun': MeasureDistDirTime(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/objectgoal_suncg_mf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'object_goal',
5-
'goal': {'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
5+
'goal': {'type': 'object', 'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
66
'measure_fun': MeasureDistDirTime(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/objectgoal_suncg_se.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'object_goal',
5-
'goal': {'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
5+
'goal': {'type': 'object', 'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
66
'measure_fun': MeasureDistDirTime(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/objectgoal_suncg_sf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'object_goal',
5-
'goal': {'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
5+
'goal': {'type': 'object', 'categories': ['arch', 'door'], 'select': 'random', 'dist_from_bbox': True},
66
'measure_fun': MeasureDistDirTime(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/pointgoal_mp3d_m.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'point_goal',
5-
'goal': {'position': 'random', 'radius': 0.25},
5+
'goal': {'type': 'position', 'position': 'random', 'radius': 0.25},
66
'measure_fun': MeasureDistDirTime(goal_dist_threshold=0.4),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/pointgoal_mp3d_s.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'point_goal',
5-
'goal': {'position': 'random', 'radius': 0.25},
5+
'goal': {'type': 'position', 'position': 'random', 'radius': 0.25},
66
'measure_fun': MeasureDistDirTime(goal_dist_threshold=0.4),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/pointgoal_suncg_me.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'point_goal',
5-
'goal': {'position': 'random', 'radius': 0.25},
5+
'goal': {'type': 'position', 'type': 'position', 'position': 'random', 'radius': 0.25},
66
'measure_fun': MeasureDistDirTime(goal_dist_threshold=0.4),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/pointgoal_suncg_mf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'point_goal',
5-
'goal': {'position': 'random', 'radius': 0.25},
5+
'goal': {'type': 'position', 'type': 'position', 'position': 'random', 'radius': 0.25},
66
'measure_fun': MeasureDistDirTime(goal_dist_threshold=0.4),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/pointgoal_suncg_se.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'point_goal',
5-
'goal': {'position': 'random', 'radius': 0.25},
5+
'goal': {'type': 'position', 'type': 'position', 'position': 'random', 'radius': 0.25},
66
'measure_fun': MeasureDistDirTime(goal_dist_threshold=0.4),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/pointgoal_suncg_sf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'point_goal',
5-
'goal': {'position': 'random', 'radius': 0.25},
5+
'goal': {'type': 'position', 'position': 'random', 'radius': 0.25},
66
'measure_fun': MeasureDistDirTime(goal_dist_threshold=0.4),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/roomgoal_mp3d_m.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'room_goal',
5-
'goal': {'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
5+
'goal': {'type': 'room', 'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
66
'measure_fun': MeasureGoalRoomType(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/roomgoal_mp3d_s.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'room_goal',
5-
'goal': {'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
5+
'goal': {'type': 'room', 'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
66
'measure_fun': MeasureGoalRoomType(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/roomgoal_suncg_mf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'room_goal',
5-
'goal': {'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
5+
'goal': {'type': 'room', 'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
66
'measure_fun': MeasureGoalRoomType(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/envs/roomgoal_suncg_sf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config = {
44
'task': 'room_goal',
5-
'goal': {'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
5+
'goal': {'type': 'room', 'minRooms': 1, 'roomTypes': 'any', 'select': 'random'},
66
'measure_fun': MeasureGoalRoomType(),
77
'reward_type': 'dist_time',
88
'agent': {'radialClearance': 0.2},

minos/config/sim_args.py

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55

66
from easydict import EasyDict as edict
7-
from minos.lib.common import get_goal_for_task
87
from minos.config import sim_config
98

109
def str2bool(v):
@@ -225,7 +224,6 @@ def parse_sim_args(parser):
225224
'positionAt': 'goal'
226225
}]
227226

228-
args.goal = get_goal_for_task(args.task)
229227
args.audio = {'debug': args.debug, 'debug_memory': args.debug_audio_memory}
230228
args.actionTraceLogFields = ['forces']
231229
args.auto_start = not args.manual_start

minos/config/sim_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def get_scene_params(arch_only=False, retexture=False, empty_room=False, dataset
6161

6262
# task params
6363
'task': 'room_goal',
64-
'goal': {'roomTypes': 'any', 'select': 'random'},
64+
'goal': {'type': 'room', 'roomTypes': 'any', 'select': 'random'},
6565
'scenes_file': '../data/scenes.multiroom.csv',
6666
'states_file': '../data/episode_states.suncg.csv.bz2',
6767
'roomtypes_file': '../data/roomTypes.suncg.csv',

minos/lib/common.py

-18
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,6 @@ def ensure_dir_exists(path):
4646
raise
4747

4848

49-
def get_goal_for_task(task, goals=None):
50-
# set goal depending on task type
51-
if task == 'room_goal':
52-
goal = {'minRooms': 1, 'roomTypes': 'any', 'select': 'random'}
53-
elif task == 'point_goal':
54-
goal = {'position': 'random', 'radius': 0.25}
55-
elif task == 'door_goal':
56-
goal = {'categories': ['arch', 'door'], 'select': 'random'}
57-
else: # default to door_goal
58-
goal = {'categories': ['arch', 'door'], 'select': 'random'}
59-
60-
# if objectId goals provided, override default task goals
61-
if goals:
62-
goal = {'objectIds': [g['actionArgs'] for g in goals]}
63-
64-
return goal
65-
66-
6749
def observation_to_reward(reward_type, observation, meas, term, success, last_observation, frame_skip):
6850
if reward_type == 'path_delta':
6951
if term and success:

minos/lib/util/ActionTraces.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import csv
22

3-
from ..common import get_goal_for_task
43

4+
# TODO(MS) get rid of this default task-to-goal mapping by storing goal specs in action trace header
5+
TASK_TO_DEFAULT_GOAL = {
6+
'point_goal': {'type': 'position', 'position': 'random', 'radius': 0.25}
7+
'object_goal': {'type': 'object', 'categories': ['arch', 'door'], 'select': 'random'},
8+
'room_goal': {'type': 'room', 'minRooms': 1, 'roomTypes': 'any', 'select': 'random'}
9+
}
510

611
class ActionTrace:
712
""" Action Trace for a episode"""
@@ -22,7 +27,7 @@ def start_state(self):
2227
'scene': {'fullId': self.sceneId},
2328
'task': self.task,
2429
'start': self.start,
25-
'goal': get_goal_for_task(self.task),
30+
'goal': TASK_TO_DEFAULT_GOAL.get(self.task, None),
2631
}
2732
return self._start_state
2833

minos/server/check_episode_states.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function checkState(state, cb) {
8585
simulator.configure({
8686
scene: _.defaults({ fullId: sceneId }, sceneDefaults),
8787
start: { position: [state.startX, state.startY, state.startZ], angle: state.startAngle },
88-
goal: { position: [state.goalX, state.goalY, state.goalZ], objectIds: state.goalObjectId }
88+
goal: { type: 'position', position: [state.goalX, state.goalY, state.goalZ], objectIds: state.goalObjectId }
8989
});
9090

9191
var gridname = outputDir + '/' + state.sceneId + '.' + archType + '.grid.json';

0 commit comments

Comments
 (0)