Skip to content

Unable to Add Custom Object Node Using Official Example (expand_scene always fails) #155

Description

@bbqgwx996

Hi VirtualHome team,

I've been following the official example for adding a node into the environment, as shown in your documentation:

comm.reset(0)
success, graph = comm.environment_graph()
with open(f"scene_0_graph.json", "w") as f:
    json.dump(graph, f, indent=2)

# Get the fridge node
fridge_node = [node for node in graph['nodes'] if node['class_name'] == 'fridge'][0]
fridge_node['states'] = ['OPEN']

# Create a new object node
new_node = {
    'id': 1000,
    'class_name': 'salmon',
    'states': []
}

# Add an edge indicating INSIDE relation
new_edge = {'from_id': 1000, 'to_id': fridge_node['id'], 'relation_type': 'INSIDE'}

graph['nodes'].append(new_node)
graph['edges'].append(new_edge)

# Try to apply the updated graph
success, message = comm.expand_scene(graph)
if not success:
    print("[ExpandScene Failed]", message)

Unfortunately, no matter what object I try to add, the call to expand_scene always fails. I've been debugging this for the past 3–4 days, and still can't successfully insert any custom object (even ones that exist in the original scene or ones whose prefab_name appears to be valid).

Only the cat example from your demo seems to work — any other object, even those present in the current scene, are reported as unplaced during expansion.

This makes me wonder: is there some hidden constraint or locking mechanism that prevents arbitrary object insertion? Is there a list of allowed object types or a required initialization procedure that’s not documented?

I'd really appreciate any insight or help — and if there's any extra logging or debug output I can provide, I'm happy to share.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions