-
Notifications
You must be signed in to change notification settings - Fork 389
Open
Description
Hi, thanks for your excellent work!
I'm trying to obtain pointmap from base_camera in pick_cube env. I want to check if the pointmap contains the tcp(eef) point.
following https://github.com/haosulab/ManiSkill/blob/main/mani_skill/envs/utils/observations/observations.py, my code is:
positions_cam = traj['obs']['sensor_data']['base_camera']['Position'][..., :3] / 1000.0 # (T, H, W, 3) convert to meters
# Change to world coordinates
cam2world_gl = traj['obs']['sensor_param']['base_camera']['cam2world_gl'][:] # (T, 4, 4)
R = cam2world_gl[:, :3, :3] # (T, 3, 3)
T = cam2world_gl[:, :3, 3]
positions_world = np.einsum('tij,thwj->thwi', R, positions_cam) + T[:, None, None, :] # (T, H, W, 3)
tcp_pos = traj['obs']['extra']['tcp_pose'][:, :3] # (T, 3)
tcp_pos_expanded = tcp_pos[:, None, None, :]
H, W = positions_world.shape[1:3]
tcp_pos_expanded = np.tile(tcp_pos_expanded, (1, H, W, 1))
diffs = np.linalg.norm(positions_world - tcp_pos_expanded, axis=-1) # (T, H, W)
min_dists = np.min(diffs, axis=(1, 2)) #
for t in range(len(min_dists)):
print(f"Frame {t}: min distance from TCP to pointmap points: {min_dists[t]:.6f}")
But the min distance results are around 0.9 meters for all frames, so I'm confused about that.
Hope to get help from you.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels