From abd847bdd4b60ef10e4671a5201960e97642349b Mon Sep 17 00:00:00 2001 From: HiroIshida Date: Sun, 15 Dec 2024 02:52:29 +0900 Subject: [PATCH] Rotate tag by 90 to align x-axis with pr2 gripper --- jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/Makefile | 4 ++-- .../{add_margin.py => rotate_and_add_margin.py} | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) rename jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/{add_margin.py => rotate_and_add_margin.py} (97%) diff --git a/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/Makefile b/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/Makefile index 1abf8b9be3..7731412c25 100644 --- a/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/Makefile +++ b/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/Makefile @@ -16,9 +16,9 @@ build/tag_plate.stl: tag_plate.scad openscad -o $@ $< echo "Generated $@" -build/tag_with_margin.png: add_margin.py +build/tag_with_margin.png: rotate_and_add_margin.py mkdir -p build - python3 ./add_margin.py tag41_12_00000.png $@ + python3 ./rotate_and_add_margin.py tag41_12_00000.png $@ echo "Generated $@" build/april_tag_print.pdf: april_tag_print.tex build/tag_with_margin.png diff --git a/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/add_margin.py b/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/rotate_and_add_margin.py similarity index 97% rename from jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/add_margin.py rename to jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/rotate_and_add_margin.py index 5f5ee893c1..29d4aaf709 100755 --- a/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/add_margin.py +++ b/jsk_pr2_robot/jsk_pr2_accessories/pr2_hand_apriltag/rotate_and_add_margin.py @@ -10,7 +10,8 @@ def main(): args = parser.parse_args() img = Image.open(args.input) - + img = img.rotate(90) + if img.width != img.height: raise ValueError("Input image must be square")