diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index a83d505..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Style - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - - name: Install flake - run: | - python -m pip install --upgrade pip - pip install flake8 - pip install flake8-bugbear - pip install black - - - name: Flake 8 Syntax Errors - run: | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - - - name: Flake 8 Syntax Warnings - run: | - flake8 . --count --statistics - - - name: Black formatting - run: | - black . --check \ No newline at end of file diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index b61926d..585c79a 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -18,7 +18,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9","3.10"] steps: - uses: actions/checkout@v4 @@ -37,4 +37,4 @@ jobs: - name: Pytest run: | - pytest . \ No newline at end of file + pytest -s -v test/test_sfm_process.py \ No newline at end of file diff --git a/.github/workflows/test_ubuntu.yml b/.github/workflows/test_ubuntu.yml deleted file mode 100644 index 52a2192..0000000 --- a/.github/workflows/test_ubuntu.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Ubuntu - -on: - push: - branches: [ "main" ] - paths-ignore: - - "README.md" - - "docs/**" - - "marimapper/scripts/**" - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11","3.12"] - - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip cache purge - pip install .[develop] - - - name: Pytest - run: | - pytest . \ No newline at end of file diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml deleted file mode 100644 index 98e7580..0000000 --- a/.github/workflows/test_windows.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Windows - -on: - push: - branches: [ "main" ] - paths-ignore: - - "README.md" - - "docs/**" - - "marimapper/scripts/**" - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - test: - runs-on: windows-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] - - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip cache purge - pip install .[develop] - - - name: Pytest - run: | - pytest . \ No newline at end of file diff --git a/marimapper/sfm.py b/marimapper/sfm.py index 07abea9..6e1fcf7 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -1,7 +1,9 @@ +# it's something in heeeere from pathlib import Path from tempfile import TemporaryDirectory +print("importing pycolmap") import pycolmap - +print("pycolmap imported!") from marimapper.database_populator import ( populate_database, camera_model_radial, @@ -37,19 +39,25 @@ def sfm( populate_database(database_path, leds_2d, camera_model, camera_fov) + logger.error(f"database_path: {database_path}") + logger.error(f"temp_dir: {temp_dir}") + options = pycolmap.IncrementalPipelineOptions() options.triangulation.ignore_two_view_tracks = False # used to be true options.min_num_matches = 9 # default 15 options.mapper.abs_pose_min_num_inliers = 9 # default 30 options.mapper.init_min_num_inliers = 50 # used to be 100 - with SupressLogging(): + # I think what's happening here is that this is spinning up a thread which is crashing the forked process https://github.com/python/cpython/issues/77906 + # Aaaah if this sig sevs then it got caught by the handler + if True: pycolmap.incremental_mapping( database_path=database_path, image_path=temp_dir, output_path=temp_dir, options=options, ) + logger.error("sfm done!!!!") # NOTE! # There might be more map folders than just "0", however this is the base section and only the one we're diff --git a/marimapper/sfm_process.py b/marimapper/sfm_process.py index 9635083..e700150 100644 --- a/marimapper/sfm_process.py +++ b/marimapper/sfm_process.py @@ -64,6 +64,7 @@ def __init__( camera_model_name: str = camera_model_radial.__name__, camera_fov: int = 60, ): + print("initing sfm") super().__init__() self._input_queue: Queue2D = Queue2D() self._output_queues: list[Queue3D] = [] @@ -83,6 +84,7 @@ def __init__( self.leds_2d = existing_leds if existing_leds is not None else [] self.leds_3d: list[LED3D] = [] self.daemon = True + print("finished init sfm") def get_input_queue(self) -> Queue2D: return self._input_queue @@ -97,16 +99,18 @@ def stop(self): self._exit_event.set() def run(self): - + print("sfm running") needs_initial_reconstruction = len(self.leds_2d) > 0 update_info = True while not self._exit_event.is_set(): + print("looping") update_sfm = False print_overlap = False print_reconstructed = False while not self._input_queue.empty(): + print("items in input queue!") control, data = self._input_queue.get() if control == DetectionControlEnum.DETECT: @@ -129,9 +133,9 @@ def run(self): start_time = 0 end_sfm_time = 0 end_post_process_time = 0 - + print(f"len of leds {len(self.leds_2d)}") if (update_sfm or needs_initial_reconstruction) and len(self.leds_2d) > 0: - + print("update time baby!") start_time = time.time() self.leds_3d = sfm( self.leds_2d, @@ -139,7 +143,8 @@ def run(self): camera_fov=self._camera_fov, ) end_sfm_time = time.time() - + print(f"sfm complete with time of {end_sfm_time - start_time}") + print(f"len of leds {len(self.leds_3d)}") if len(self.leds_3d) > 0: rescale(self.leds_3d) @@ -150,6 +155,7 @@ def run(self): add_normals(self.leds_3d) for queue in self._output_queues: + print(f"sending to output queue: {queue}") queue.put(self.leds_3d) if update_info: diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index 6f8a31b..c006252 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -3,36 +3,45 @@ from marimapper.queues import Queue3D from utils import get_test_dir import time -import pytest -@pytest.mark.skip("This test is flakey, needs a re-write") +# @pytest.mark.skip("This test is flakey, needs a re-write") def test_sfm_process_basic(): - + print("starting test sfm process basic") + print("\n") leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) + print("maps got") + assert len(leds) == 117, "failed to load all leds" sfm = SFM(existing_leds=leds, max_fill=0) output_queue = Queue3D() sfm.add_output_queue(output_queue) + print("here we go!") sfm.start() - - map_3d = output_queue.get(timeout=5) - - assert len(map_3d) == 21 - + print("done!") + time.sleep(2) + print("stopping") sfm.stop() - timeout = time.time() + 5 - - while sfm.is_alive(): - assert time.time() < timeout, "sfm has failed to stop" + # + # map_3d = output_queue.get(timeout=5) + # + # assert len(map_3d) == 21 + # + # sfm.stop() + # timeout = time.time() + 5 + # + # while sfm.is_alive(): + # assert time.time() < timeout, "sfm has failed to stop" def test_sfm_process_exit(): leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) + assert len(leds) == 117, "failed to load all leds" + sfm = SFM(existing_leds=leds) output_queue = Queue3D()