Skip to content

Commit

Permalink
Rotate spot camera images.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashay-bdai committed Sep 11, 2024
1 parent ea5f1bf commit 0b8d125
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion predicators/perception/spot_perceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ def step(self, observation: Observation) -> State:
imgs = [v.rgb for _, v in imgs.items()]
# import PIL
# PIL.Image.fromarray(imgs[0]).show()
# import pdb; pdb.set_trace()
self._gripper_open_percentage = observation.gripper_open_percentage
self._curr_state = self._create_state()
self._curr_state.simulator_state["images"] = imgs
Expand Down
12 changes: 7 additions & 5 deletions predicators/spot_utils/perception/spot_cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Collection, Dict, Optional, Type

import cv2
from scipy import ndimage
import numpy as np
from bosdyn.api import image_pb2
from bosdyn.client.frame_helpers import BODY_FRAME_NAME, get_a_tform_b
Expand All @@ -22,12 +23,12 @@
'right_fisheye_image': 180
}
RGB_TO_DEPTH_CAMERAS = {
# "hand_color_image": "hand_depth_in_hand_color_frame",
# "left_fisheye_image": "left_depth_in_visual_frame",
# "right_fisheye_image": "right_depth_in_visual_frame",
"hand_color_image": "hand_depth_in_hand_color_frame",
"left_fisheye_image": "left_depth_in_visual_frame",
"right_fisheye_image": "right_depth_in_visual_frame",
"frontleft_fisheye_image": "frontleft_depth_in_visual_frame",
# "frontright_fisheye_image": "frontright_depth_in_visual_frame",
# "back_fisheye_image": "back_depth_in_visual_frame"
"frontright_fisheye_image": "frontright_depth_in_visual_frame",
"back_fisheye_image": "back_depth_in_visual_frame"
}

# Hack to avoid double image capturing when we want to (1) get object states
Expand Down Expand Up @@ -173,6 +174,7 @@ def capture_images_without_context(
rgb_img_resp = name_to_response[camera_name]
depth_img_resp = name_to_response[RGB_TO_DEPTH_CAMERAS[camera_name]]
rgb_img = _image_response_to_image(rgb_img_resp)
rgb_img = ndimage.rotate(rgb_img, ROTATION_ANGLE[camera_name])
depth_img = _image_response_to_image(depth_img_resp)
# # Create transform.
# camera_tform_body = get_a_tform_b(
Expand Down

0 comments on commit 0b8d125

Please sign in to comment.