def test_shift_conversion(self): conv = Converter(shift_z_offset=0.0, box=self.box) image = OrthographicImage( self.read_image(self.file_path / self.image_name), 2000.0, 0.22, 0.4, '', Config.default_image_pose) action = Action() action.type = 'shift' action.pose = RobotPose() action.pose.x = -0.02 action.pose.y = 0.105 action.pose.a = 1.52 action.pose.d = 0.078 action.index = 1 action.shift_motion = [0.03, 0.0] draw_pose(image, action.pose, convert_to_rgb=True) draw_around_box(image, box=self.box, draw_lines=True) imageio.imwrite(str(self.file_path / 'gen-shift-draw-pose.png'), image.mat) self.assertTrue(conv.shift_check_safety(action, [image])) conv.calculate_pose(action, [image]) self.assertLess(action.pose.z, 0.0)
def to_action(self, action: Action) -> None: action.direction = self.directions[action.index] action.shift_motion = self.shift_motions[action.index] action.pose.d = 0.0 action.type = 'shift'