Skip to content

Commit

Permalink
Skip write buffer
Browse files Browse the repository at this point in the history
 - windows crashes if vbo is loaded with first point cloud
 - skip write_vbo for first point cloud
 - fix github pipelines
   - add windows to unit tests
   - add python versions to test matrix
   - update version path in setup.cfg
   - drop limitation of PyQt5 version for windows

Closes: #67
  • Loading branch information
ch-sa committed Mar 26, 2022
1 parent 6b0b22a commit 50805a2
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8]
python-version: ["3.7", "3.8", "3.9"] # "3.10" wait for Open3D support
env:
DISPLAY: ':99.0'

Expand All @@ -34,7 +34,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install flake8
pip install .[tests]
- name: Test with pytest
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest] # macos-latest,
python-version: [3.7, 3.8]
os: [ubuntu-latest, windows-latest] # macos-latest has OpenGL import error
python-version: ["3.7", "3.8", "3.9"] # "3.10" wait for Open3D support

steps:
- name: Get repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
python -m pip install --upgrade pip setuptools wheel
pip install flake8
pip install .[tests]
- name: Lint with flake8
Expand Down
2 changes: 1 addition & 1 deletion labelCloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.5"
__version__ = "0.7.6"
7 changes: 4 additions & 3 deletions labelCloud/control/pcd_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
from shutil import copyfile
from typing import TYPE_CHECKING, List, Optional, Tuple

import pkg_resources

import numpy as np
import open3d as o3d
import pkg_resources

from ..io.pointclouds import BasePointCloudHandler, Open3DHandler
from ..model import BBox, Perspective, PointCloud
Expand Down Expand Up @@ -97,7 +96,9 @@ def get_next_pcd(self) -> None:
self.current_id += 1
self.save_current_perspective()
self.pointcloud = PointCloud.from_file(
self.pcd_path, self.saved_perspective
self.pcd_path,
self.saved_perspective,
write_buffer=self.pointcloud is not None,
)
self.update_pcd_infos()
else:
Expand Down
13 changes: 8 additions & 5 deletions labelCloud/model/point_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
from pathlib import Path
from typing import List, Optional, Tuple

import pkg_resources

import numpy as np
import OpenGL.GL as GL
import pkg_resources

from . import Perspective
from ..control.config_manager import config
Expand Down Expand Up @@ -65,6 +64,7 @@ def __init__(
colors: Optional[np.ndarray] = None,
init_translation: Optional[Tuple[float, float, float]] = None,
init_rotation: Optional[Tuple[float, float, float]] = None,
write_buffer: bool = True,
) -> None:
start_section(f"Loading {path.name}")
self.path = path
Expand All @@ -89,14 +89,17 @@ def __init__(
)
logging.info("Generated colors for colorless point cloud based on height.")

self.write_vbo()
if write_buffer:
self.write_vbo()

logging.info(green(f"Successfully loaded point cloud from {path}!"))
self.print_details()
end_section()

@classmethod
def from_file(cls, path: Path, perspective: Optional[Perspective]) -> "PointCloud":
def from_file(
cls, path: Path, perspective: Optional[Perspective], write_buffer: bool = True
) -> "PointCloud":
init_translation, init_rotation = (None, None)
if perspective:
init_translation = perspective.translation
Expand All @@ -105,7 +108,7 @@ def from_file(cls, path: Path, perspective: Optional[Perspective]) -> "PointClou
points, colors = BasePointCloudHandler.get_handler(
path.suffix
).read_point_cloud(path=path)
return cls(path, points, colors, init_translation, init_rotation)
return cls(path, points, colors, init_translation, init_rotation, write_buffer)

def to_file(self, path: Optional[Path] = None) -> None:
if not path:
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ numpy~=1.21.4
open3d~=0.14.1
PyOpenGL~=3.1.5
PyQt5~=5.14.1
pytest~=7.1.1
pytest-qt~=4.0.2
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = labelCloud
version = attr: labelCloud.__version__
version = attr: labelCloud.__init__.__version__
maintainer = Christoph Sager
maintainer_email = [email protected]
license = GNU General Public License v3.0
Expand Down Expand Up @@ -52,8 +52,7 @@ install_requires =
numpy
open3d
PyOpenGL
PyQt5 <= 5.14.1;platform_system=='Windows'
PyQt5;platform_system!='Windows'
PyQt5
python_requires = >=3.6

[options.entry_points]
Expand Down

0 comments on commit 50805a2

Please sign in to comment.