-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds camera pose getter and local pose setter #1174
base: main
Are you sure you want to change the base?
Changes from 9 commits
73b4f13
b6dc0f9
b448553
bc5ff1c
8a2f365
3154d40
b700d4a
6f27f3a
1d14eda
dd7f99c
4e39dd4
7a5ce12
da0a686
2641d0d
b342c97
65fcca0
e04c919
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,6 +360,31 @@ def test_camera_set_world_poses_from_view(self): | |
torch.testing.assert_close(camera.data.pos_w, eyes) | ||
torch.testing.assert_close(camera.data.quat_w_ros, quat_ros_gt) | ||
|
||
def test_camera_get_world_poses(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please also add a unit test for the local pose APIs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the suggestion. I'll add it soon There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added. |
||
"""Test camera function to get world pose.""" | ||
camera = Camera(self.camera_cfg) | ||
# play sim | ||
self.sim.reset() | ||
|
||
# convert to torch tensors | ||
position = torch.tensor([POSITION], dtype=torch.float32, device=camera.device) | ||
orientation = torch.tensor([QUAT_OPENGL], dtype=torch.float32, device=camera.device) | ||
# set new pose | ||
camera.set_world_poses(position.clone(), orientation.clone(), convention="opengl") | ||
|
||
# Simulate for a few steps | ||
# note: This is a workaround to ensure that the textures are loaded. | ||
# Check "Known Issues" section in the documentation for more details. | ||
for _ in range(5): | ||
self.sim.step() | ||
|
||
pos_w = camera.get_world_poses()[0] | ||
quat_w_world = camera.get_world_poses()[1] | ||
|
||
# check if transform correctly set in output | ||
torch.testing.assert_close(pos_w, position) | ||
torch.testing.assert_close(quat_w_world, orientation) | ||
|
||
def test_intrinsic_matrix(self): | ||
"""Checks that the camera's set and retrieve methods work for intrinsic matrix.""" | ||
camera_cfg = copy.deepcopy(self.camera_cfg) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this API also work for local coordinates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it works for local coordinates