Skip to content

Commit

Permalink
Fix unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotochleb committed Oct 30, 2024
1 parent b8bd1f9 commit 4c0f666
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 6 additions & 3 deletions happypose_ros/test/happypose_testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,16 @@ def publish_image(
height=bgr.shape[0],
width=bgr.shape[1],
k=K.reshape(-1),
roi=RegionOfInterest(
)
if bgr.shape != cropped_bgr.shape:
info_msg.roi = RegionOfInterest(
width=width,
height=height,
x_offset=x_offset,
y_offset=y_offset,
),
)
do_rectify=True,
)

# Publish messages
self._cam_pubs[cam][0].publish(img_msg)
self._cam_pubs[cam][1].publish(info_msg)
Expand Down
12 changes: 11 additions & 1 deletion happypose_ros/test/single_view_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,27 @@ def test_14_region_of_interest(self: ActiveIoHandler) -> None:
detections = self.node.get_received_message("happypose/detections")

self.assertGreaterEqual(
len(detections.detections), 1, "Incorrect number of detected objects!"
len(detections.detections), 2, "Incorrect number of detected objects!"
)

# In compressed case pose of 05 object is not reliable
ycbv_02 = assert_and_find_detection(detections, "ycbv-obj_000002")
ycbv_15 = assert_and_find_detection(detections, "ycbv-obj_000015")

# Based on ground truth, object poses for image 629
ycbv_02_pose = Pose(
position=Point(**dict(zip("xyz", [0.0552, -0.0913, 1.0283]))),
orientation=Quaternion(
**dict(zip("xyzw", [0.2279, 0.1563, 0.0245, 0.9607]))
),
)

ycbv_15_pose = Pose(
position=Point(**dict(zip("xyz", [-0.1013, 0.0329, 0.9138]))),
orientation=Quaternion(
**dict(zip("xyzw", [0.2526, 0.4850, 0.7653, -0.3392]))
),
)

assert_pose_equal(ycbv_02.results[0].pose.pose, ycbv_02_pose)
assert_pose_equal(ycbv_15.results[0].pose.pose, ycbv_15_pose)

0 comments on commit 4c0f666

Please sign in to comment.