Actions
Structure of the Programs
Agents interact in VirtualHome via programs, lists of instructions that tell which actions each agent should do, and with which objects.
These commands are called using unity_simulator.UnityCommunication.render_script(), where a script is a list of strings of the form:
<char{id1}> {action1}
with {action1} being of the form
[action_name] # action with no args
[action_name] arg1 # action with a single arg
[action_name] arg1 arg2 # action with 2 args
And args correspond to objects, of the form
<object_name> (object_id)
An example of an action would be
<char0> [put] <glass> (3) <table> (2)
Multiple agents can do actions at the same time. You specify it as follows
<char0> [put] <glass> (3) <table> (2) | <char1> [walk] <kitchen> (5)
Actions available
Below is the list of actions available, notice that after an action is executed, the graph is updated, according to the rules in Environments.
Walk
Walks to a room or object
- Arguments
1
- Modifier
- Preconditions
characteris not sittingobj1is reachable (not inside some closed container) orobj1is a room.obj1is not grabbed
- Postconditions
character will move at a distance close to the object, making sure it is visible.
if
obj1is a room, character will move to the center of the room
- Example
[walk] <kitchen> (1)
Run
Runs to a room or object
- Arguments
1
- Modifier
- Preconditions
characteris not sittingobj1is reachable (not inside some closed container) orobj1is a room.obj1is not grabbed
- Postconditions
character will move at a distance close to the object, making sure it is visible.
if
obj1is a room, character will move to the center of the room
- Example
[run] <kitchen> (1)
Walktowards
Walks some distance towards a room or object
- Arguments
1
- Modifier
- Preconditions
characteris not sittingobj1is reachable (not inside some closed container) orobj1is a room.obj1is not grabbed
- Postconditions
character will move at a distance close to the object, making sure it is visible.
if
obj1is a room, character will move to the center of the room
- Example
[walktowards] <kitchen> (1)[walktowards] <table> (1) :3:
Walkforward
Walks 1 meter forward.
- Arguments
0
- Modifier
- Preconditions
characteris not sitting
- Postconditions
character will 1 meter forward according to current orientation.
- Example
[walkforward]
TurnLeft
Turns 30 degrees left
- Arguments
0
- Modifier
- Preconditions
characteris not sitting
- Postconditions
character is turned 30 degree counterclockwise
- Example
[turnleft]
TurnRight
Turns 30 degrees right
- Arguments
0
- Modifier
- Preconditions
characteris not sitting
- Postconditions
character is turned 30 degree clockwise
- Example
[turnleft]
Sit
Sit on an object
- Arguments
1
- Modifier
- Preconditions
characteris not sittingcharacteris close toobj1obj1has propertysittablenumber of objects on obj1 must be less than: ‘couch’: 4, ‘bed’: 4, ‘chair’: 1, ‘loveseat’: 2, ‘sofa’: 4, ‘toilet’: 1, ‘pianobench’: 2, ‘bench’: 2
- Postconditions
Add directed edges: character sitting obj1
- Example
[sit] <chair> (1)
StandUp
Stand Up
- Arguments
0
- Modifier
- Preconditions
characterstate is sitting
- Postconditions
characterremove state sitting
- Example
[standup]
Grab
Grab an object
- Arguments
1
- Modifier
- Preconditions
obj1property is grabbable except waterexists edge
charactercloseobj1characteris close toobj1obj1is reachable (not inside some closed container)No edge
characterholds_rhany object or no edgecharacterholds_lhany_object. Character has at least one free hand.
- Postconditions
Add directed edges: character
holds_rhorhold_lh,obj1obj1is not anymore on a surface or inside a container
- Example
[grab] <apple> (1)
Open
Open an object
- Arguments
1
- Modifier
- Preconditions
obj1property isopennableand state isclosed.characteris close toobj1obj1is reachable (not inside some closed container)No edge
characterholds_rhany object or no edgecharacterholds_lhany_object. Character has at least one free hand.
- Postconditions
obj1state isopen
- Example
[open] <fridge> (1)
Close
Close an object
- Arguments
1
- Modifier
- Preconditions
obj1property isopennableand state isopen.characteris close toobj1obj1is reachable (not inside some closed container)No edge
characterholds_rhany object or no edgecharacterholds_lhany_object. Character has at least one free hand.
- Postconditions
obj1state isclosed.
- Example
[close] <fridge> (1)
Put
Put an object on some other object
- Arguments
2
- Modifier
- Preconditions
exists edge character
holds_lhobj1or characterholds_rhobj1exists edge
charactercloseobj2
- Postconditions
remove directed edges: character
holds_lhobj1or characterholds_rhobj1add directed edges:
obj1onobj2
- Example
[putback] <apple> (1) <table> (1)
PutIn
Put an object inside some other object
- Arguments
2
- Modifier
- Preconditions
exists edge character
holds_lhobj1or characterholds_rhobj1exists edge
charactercloseobj2obj2is notclosed
- Postconditions
remove directed edges: character
holds_lhobj1or characterholds_rhobj1add directed edges:
obj1insideobj2
- Example
[putin] <apple> (1) <fridge> (1)
SwitchOn
Turn an object on
- Arguments
1
- Modifier
- Preconditions
obj1has propertyswitchobj1state isoffexists edge
charactercloseobj1
- Postconditions
obj1state ison
- Example
[switchon] <stove> (1)
SwitchOff
Turn an object off
- Arguments
1
- Modifier
- Preconditions
obj1has propertyswitchobj1state isonexists edge
charactercloseobj1
- Postconditions
obj1state isoff
- Example
[switchoff] <stove> (1)
Drink
Drink from an object
- Arguments
1
- Modifier
- Preconditions
obj1property is drinkable or recipientexists edge
charactercloseobj1
- Postconditions
- Example
[drink] <waterglass> (1)
Touch
Touch an object
- Arguments
1
- Modifier
- Preconditions
characteris close toobj1obj1is reachable (not inside some closed container)
- Postconditions
- Example
[touch] <stove> (1)
LookAt
Look at an object
- Arguments
1
- Modifier
- Preconditions
characteris facingobj1obj1is reachable (not inside some closed container)
- Postconditions
- Example
[lookat] <stove> (1)