habitat-sim
habitat-sim copied to clipboard
Finding global coordinates of a point in a scene to place objects
I am trying to initialize a scene with different objects at different (but fixed) points several times for a benchmark. How do I find the global coordinates in the scene so I could add an object there - for example, the coordinates of the table top in one of the apartment scenes?
If you are using ReplicaCAD, then one possibility is to look up the translation of an object in the respective JSON-scene configuration file in the folder "configs/scenes". However, I would also be interested in getting the global coordinates and the scale (for example of a table mesh) from the simulation, e.g. in order to place objects on a tabletop. The scale is not contained in the JSON configuration files.
Hey @adrshsrvstv,
@Ukias is correct that the transform information in the JSON could be used to get object transform information outside of the simulator API.
Depending on the specifics of your situation, there are a few options to get this kind of information within the simulator:
- If you want details of an object's transform, you can query it from the ObjectManager. See the RigidObjects tutorial for details of the API.
- You can query the object's bounding box (in local space) to compute points of interest such as the top, bottom, and corner of the object. First get the object's SceneNode and then query the mesh_bb.
- If you are using the Viewer application, you could print the raycast hit position from a mouse click (right click with
--enable-physicsto add a primitive at the click location. Add a line of code to print that location).
output for object's scene node: mesh_bb = Range({0, 0, 0}, {0, 0, 0}). (Not working)
transform is not precise enough. I need the top of a table. I want to place objects exactly on a table.
Repository with problem of the table mesh:
https://github.com/Ukias/habitat_example
For me solved by adding the maximum of root_scene_node.cumulative__bb to the translation of the root_scene_node.