meaning of `ObjectID` attribute
See original GitHub issueHi!
I’m working with ALFRED right now and need to directly manipulate AI2-THOR scenes (in the form of point clouds) according to the tasks that are given. I was wondering how to interpret the ObjectID
string which is in the ALFRED task descriptions (see pic below) to know with which object do we interact with exactly?
In the issue I’ve opened the creators sent me here to ask this questions, because this is an intrinsic THOR API mechanism.
Side question: if we set the state of the scene by sending SetObjectPoses
action, can we save the new state in a .unity
file? Maybe a few hints on how to add this functionality if it’s not there? Would be great!
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Fundamentals of ObjectID fields—ArcMap | Documentation
The ObjectID field is maintained by ArcGIS and guarantees a unique ID for each row in a table. When you look at a...
Read more >ObjectId() — MongoDB Manual
A 4-byte timestamp, representing the ObjectId's creation, measured in seconds since the Unix epoch. · A 5-byte random value generated once per process....
Read more >What Is Objectid in Mongodb and How to Generate ...
_id is a 12 bytes hexadecimal number which assures the uniqueness of every document. It is called ObjectId. In this blog we are...
Read more >$OBJECT_ID (0x40) - Attribute - NTFS Documentation
The Object Id was introduced in Windows 2000. Every MFT Record is assigned a unique GUID. Additionally, a record may have a Birth...
Read more >What Is MongoDB's _id Field and How to Use It
The _id field is immutable—that is, once a document exists in your MongoDB system, it has, by definition, been assigned an _id, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So to actually edit and then save the scene file, this will need to be done without the python controller as this must be done from the Unity editor itself. The python interface is only meant to interact directly with a build of THOR from Unity, not the asset files themselves from within the Unity editor.
Since it seems like what you are wanting is to save some new
.unity
scene files after having made changes to them, what you will likely need to do is something like serialize out the information of the object poses that you would put throughSetObjectPoses
and then apply them to a scene, then save those changes as a new scene all from within the Unity Editor itself. You may need to do something like create an editor function that will essentially allow you to manipulate a scene as if you were using one of Unity’s built-in dialogue boxes. This will allow you to make changes to a scene via a script, and then save the scene as a new.unity
asset file.This sort of leads into your other question.
This position corresponds to the position field of the game object’s
Transform
component. First of all, there is the concept of aGameObject
within Unity. Basically game objects are any objects that exist within a scene. This can be things like a character, environment objects, lights, sound emitters etc. Not all game objects have components on them that have a mesh, a renderer, etc, but all of them have aTransform
component.The
Transform
component represents a sort of pivot point that a game object can be manipulated from. Wherever this transform is centered about an object, all position and rotation changes are applied about that point.The
Transform
center is not necessarily the center of the bounding box. Some objects have their transform at the average center of the mesh of an object, but often times the transform is centered about a different point, so this is not guaranteed.Take for example these two objects, a statue and an apple. The apple’s transform is centered around the average center of the apple object. Moving it moves the entire apple based on the center, and rotating the apple will change the
Rotation
field of theTransform
by rotating it about the center of the apple. However, the statue’s transform is centered closer to the base of the statue rather than the average center of the statue. This means when something like the rotation of the statue is modified within the statue’sTransform
it will rotate about its base where the transform is rather than about the center.One thing to potentially look into is to recreate the logic used in the
SetObjectPoses
script, but integrate it into an editor function that will allow it to work in “editor-time” rather than runtime.SetObjectPoses
will only execute in-editor if you hit thePlay
button up at the top of the editor, going into runtime mode. However, any changes to objects made during runtime will not be saved in the scene, as you can only save the scene while not in run mode but only in “editor mode.” So one thing you may need to look into is to either store all the position/rotation changes you want to make to objects in the scene in some sort of serialized way, and to then load it up into the editor function to make changes that can be saved. You may also be able to do something like make changes in runtime mode but then serialize out those changes, which can then be applied again “for real” in editor mode.The
ObjectID
is generated for each sim object in a scene, and is comprised of the object’s type as well as its position in world spaceInternally, this value is generated once at the start of opening a new scene in THOR, and is again regenerated when the
SetObjectPoses
action is run. For example, anApple
in some scene could have a default position of(-02.08, 00.94, -03.62)
which, if you just loaded this scene without doing any object rearrangement via actions likeSetObjectPoses
orInitialRandomSpawn
, theObjectID
for this apple would beApple|-02.08|+00.94|-03.62
If, however, after initially loading up this scene, you ran
SetObjectPoses
to rearrange the apple to some new default location, say (0, 0, 0), then the apple’sObjectID
would change toApple|+00.00|+00.00|+00.00
since the new “default” or starting location of the apple has been set bySetObjectPoses
.Note that actions like
PickupObject
andPutObject
do NOT change theObjectID
, as even though these can reposition objects, they are used for manipulation after a scene has been set to its desired default configuration. TheSetObjectPoses
action is explicitly meant to be used for such initialization, and should be considered as an extension of the initialization process on top of setting up theController
with your desired parameters like field of view and resolution.Since
SetObjectPoses
can change theObjectID
of objects, in order to track which object is being affected in a scene, there is another unique identifier in a sim object’s metadata called thename
. The name of an object is the type of the object appended with a unique string identifier that never changes, even when reloading the scene or repositioning the object viaSetObjectPoses
. This means you can use the objectname
to identify a specific object regardless of your initialization process.This information and more is returned as metadata that each object in a scene that is interactable has. This object metadata gives info of the state of the object, position, name, current ObjectID, and more that can be used to make sure you know exactly which object you are trying to interact with in what way. Field like
pickupable
andmoveable
also indicate the types of actions you can perform on said object, so for example something static like aCountertop
object would not be able to be picked up and moved by the agent since it is a structure built into the side of a wall in a kitchen, but an object like aBook
is pickupable. All this information is annotated in the object metadata, and further details of the types of interactions and what actions to call in order to perform them are on our documentation site.Additionally, there is currently not a way to save the unity scene file after running
SetObjectPoses
as an action. This would have to be custom functionality added to the Unity Editor itself, as you will need to interface with the Editor in order to save the scene as a new version of the scene after using something likeSetObjectPoses
. Currently this isn’t exposed via the python interface as that only interacts with the build of Unity, not the editor itself. However, including theSetObjectPoses
action as part of your initialization step will be functionally the same as saving the unity scene as a new scene and loading that, so unless you need the unity file itself as its own manipulatable asset, you should be able to replicate any scene configuration generated viaSetObjectPoses
by just runningSetObjectPoses
itself after initializing the controller.