habitat-lab icon indicating copy to clipboard operation
habitat-lab copied to clipboard

`get_camera_transform` from `habitat.tasks.rearrange.utils` uses inconsistent getting method

Open zephirefaith opened this issue 1 year ago • 4 comments

Habitat-Lab and Habitat-Sim versions

Habitat-Lab: v0.3.0 or master?

Habitat-Sim: v0.3.0 or master?

Habitat is under active development, and we advise users to restrict themselves to stable releases of Habitat-Lab and Habitat-Sim. The bug you are about to report may already be fixed in the latest version.

Master branch contains 'bleeding edge' code, but we do appreciate bug reports for it!

🐛 Bug

The cameras attached to articulated agents are initialized using ArticulatedAgentCameraParams class here. The position for this sensor is set using the logic here. However when habitat.tasks.rearrange.utils.get_camera_transform function is used to get the absolute transformation of this camera, the getter applies inconsistent logic taking only the translation component of camera's view-matrix. This leads to a camera-pose with right translation but wrong rotation wrt world frame.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Initialize environment with Spot in it
  2. Access articulated agent camera pose using get_camera_transform
  3. Access articulated agent camera pose using sim.agents[0]._sensors[<sensor-name>].render_camera.camera_matrix.inverted()
  4. Output of 2 != output of 3

See PCD built with 3 (top) versus with 2 (bottom) below. Screenshot 2024-02-13 at 2 43 44 PM Screenshot 2024-02-13 at 2 43 55 PM

zephirefaith avatar Feb 13 '24 19:02 zephirefaith

🤯

@zephirefaith I spent several hours debugging this until I found your Issue!

SergioArnaud avatar Mar 09 '24 04:03 SergioArnaud

Yeah, this is a pain. @SergioArnaud happy to review a fix if you want to tackle this. :smiley:

aclegg3 avatar Mar 11 '24 15:03 aclegg3

Sorry this made you stumble @SergioArnaud! @aclegg3 given this bug has a greater damage than population of 1, I can prioritize this and push a fix today.

zephirefaith avatar Mar 11 '24 16:03 zephirefaith

Fixed in the PR linked above. Tested with zf/obs-wm-updates branch of habitat-llm. See attached videos of point-cloud from get_camera_transform method and sim.agents[0]._sensors[<sensor-name>].render_camera.camera_matrix.inverted() method. Camera used is articulated_agent_jaw_rgb and articulate_agent_jaw_depth introduced in #1856 .

https://github.com/facebookresearch/habitat-lab/assets/9580531/81ef2577-5060-4d80-b568-bbc86ebb6da0

https://github.com/facebookresearch/habitat-lab/assets/9580531/1fdc7095-d8fa-4e1b-a6ec-cdf873622b5b

zephirefaith avatar Mar 14 '24 03:03 zephirefaith