From 2238b6d1ecc0b3ba19866062656201d3ce300c81 Mon Sep 17 00:00:00 2001 From: kawanoichi Date: Thu, 9 Nov 2023 14:13:04 +0900 Subject: [PATCH] =?UTF-8?q?refactor:Makefile=E3=81=AE=E4=BF=AE=E6=AD=A3,?= =?UTF-8?q?=20etc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rear_camera_py/Makefile | 16 +++++----------- rear_camera_py/src/block_de_treasure_hunter.py | 14 +++++++++++++- rear_camera_py/src/get_area_info.py | 4 +--- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/rear_camera_py/Makefile b/rear_camera_py/Makefile index 2c617458..a0fc05c2 100644 --- a/rear_camera_py/Makefile +++ b/rear_camera_py/Makefile @@ -17,9 +17,7 @@ help: @echo " $$ make test" @echo "フォーマットを実行する" @echo " $$ make format" - @echo "スタイルチェックを実行する" - @echo " $$ make check_style" - @echo "フォーマットとスタイルチェックを実行する" + @echo "フォーマットとチェックを実行する" @echo " $$ make format-check" @echo "ソースコードチェックとテストを実行する" @echo " $$ make all-check" @@ -65,21 +63,17 @@ test: python -m unittest format: - autopep8 --in-place --recursive src/ + autopep8 --in-place --recursive src/ tests/ python -m autopep8 -i -r src/ tests/ -check_style: - python -m pycodestyle src/ tests/ - python -m pydocstyle src/ tests/ - format-check: @${make} format - @${make} check_style + python -m pycodestyle src/ tests/ + python -m pydocstyle src/ tests/ all-check: - @${make} format @${make} test - @${make} check_style + @${make} format-check debug: python -m src --debug diff --git a/rear_camera_py/src/block_de_treasure_hunter.py b/rear_camera_py/src/block_de_treasure_hunter.py index 3e045a94..a85d5da7 100644 --- a/rear_camera_py/src/block_de_treasure_hunter.py +++ b/rear_camera_py/src/block_de_treasure_hunter.py @@ -1,14 +1,20 @@ """ブロックdeトレジャーハンター攻略クラス. -@author: miyashita64 YKhm20020 +@author: miyashita64 YKhm20020 kawanoichi """ import sys import numpy as np +import os + from block_area_map import BlockAreaMap from navigator import Navigator from robot import Robot, Direction from motion import Motion +from get_area_info import GetAreaInfo + +script_dir = os.path.dirname(os.path.abspath(__file__)) # /src +PROJECT_DIR_PATH = os.path.dirname(script_dir) # /rear_camera_py class BlockDeTreasureHunter: @@ -30,6 +36,12 @@ def hunt(self, is_left_course): block_map[y][x] = 1 block_map[treasure_block_coord[0], treasure_block_coord[1]] = 2 # TODO: ここまで、マージする際に差し替える + + # ブロックエリア情報の取得 + image_name = "BlockDeTreasure.png" + image_dir_path = os.path.join(PROJECT_DIR_PATH, "image_data") + area_info = GetAreaInfo(image_name=image_name, image_dir_path=image_dir_path) + block_map = area_info.get_area_info(isL=is_left_course) print(block_map) # ブロックエリアのマップ初期化 diff --git a/rear_camera_py/src/get_area_info.py b/rear_camera_py/src/get_area_info.py index 8bed9279..bd2de6f0 100644 --- a/rear_camera_py/src/get_area_info.py +++ b/rear_camera_py/src/get_area_info.py @@ -76,7 +76,7 @@ def __init__(self, self.block_coordi_red = np.zeros(4) self.block_coordi_blue1 = np.zeros(4) self.block_coordi_blue2 = np.zeros(4) - self.course_info_block = np.zeros((4,4)) + self.course_info_block = np.zeros((4, 4)) # サークル関連 self.course_info_coordinate = np.zeros((4, 4, 4)) @@ -290,7 +290,6 @@ def check_coordi_about(self, if np.all(mask_coordi == 0): return None - # if self.develop: if self.develop and develop_img is not None: # マスクの大きさを表す線 develop_img[mask_height, :] = Color.BLACK.value @@ -1457,7 +1456,6 @@ def get_area_info(self, isL=True) -> None: self.course_info_block[row, column] = 2 self.block_count_blue += 1 - # 終了 return self.course_info_block