Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
Co-authored-by: Lewe Christiansen <[email protected]>
  • Loading branch information
SammyRamone and LeweC committed Jan 15, 2024
0 parents commit 04b6b34
Show file tree
Hide file tree
Showing 16 changed files with 1,987 additions and 0 deletions.
192 changes: 192 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
.idea/

# VSCode
.vscode/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "include/vinspect/Octree"]
path = include/vinspect/Octree
url = https://github.com/attcs/Octree.git
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package vinspect
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.1.0 (2024-01-15)
------------------
* Released by: Marc Bestmann <[email protected]>
* First beta release
87 changes: 87 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.5)
project(vinspect)

set(CMAKE_CXX_STANDARD 20)

find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(Open3D REQUIRED)
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(PythonLibs 3 REQUIRED)
find_package(pybind11 REQUIRED)
find_package(TBB REQUIRED)

list(APPEND CMAKE_MODULE_PATH "/usr/include/tbb/")

find_package(OpenMP)

if(OPENMP_FOUND)
if(NOT TARGET OpenMP::OpenMP_CXX)
find_package(Threads REQUIRED)
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
endif()
endif()

add_compile_options(-Wall -Wextra -Wpedantic)
include_directories(include)

set(SOURCES src/inspection.cpp src/utils.cpp src/sparse_mesh.cpp)

add_library(${PROJECT_NAME} SHARED ${SOURCES})

target_link_libraries(${PROJECT_NAME} TBB::tbb OpenMP::OpenMP_CXX)

ament_target_dependencies(${PROJECT_NAME}
ament_cmake
Open3D
)


pybind11_add_module(vinspect_py src/python_bindings.cpp)
ament_target_dependencies(vinspect_py PUBLIC
pybind11
Python3
Open3D
)
target_link_libraries(vinspect_py PUBLIC vinspect)
set_target_properties(vinspect_py PROPERTIES LINKER_LANGUAGE CXX)

if(BUILD_TESTING)
file(GLOB_RECURSE AMENT_LINT_AUTO_FILE_EXCLUDE
include/Octree/*
)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

# Add a hook for colcon to add the Python library directory to the PYTHONPATH environment variable
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/vinspect/hook/python_path.dsv
"prepend-non-duplicate;PYTHONPATH;lib/python3/dist-packages")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/vinspect/hook/python_path.dsv
DESTINATION share/vinspect/hook)

install(
DIRECTORY include/
DESTINATION include
)

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION lib
INCLUDES DESTINATION include)

install(
TARGETS vinspect_py
DESTINATION lib/python3/dist-packages/${PROJECT_NAME}
)

ament_export_dependencies(pybind11)
ament_export_dependencies(Python3)
ament_export_dependencies(TBB)
ament_export_dependencies(Open3D)
ament_export_libraries(${PROJECT_NAME})
ament_export_include_directories(include)

ament_package()
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Vinspect

Vinspect (short for "visualized inspection") provides a multiple functionalities that support an inspection process.

The inspection process can be performed by a human (with a tracked sensor), by a robot or by a combination of both.
It also is possible to use multiple sensortypes together.
These can produce sparse measurements (e.g. a ultrasonic sensor) or dense measurements (e.g. a camera).

All measurements can be shown together with a reference object (e.g. based on the CAD model of the part that is inspected).
Doing so will allow you to see the live coverage of this parts, both by the single measurements and a reconstructed 3D mesh based on camera images.
This allows an easier inspection process for the operator and ensures that all areas where inspected.

This package provides the core software of Vinspect and can be integrated into various applications.
We also provide a [ROS2 interface](https://github.com/DLR-MO/vinspect_ros2) which we recommend for easy integration into ROS2 based systems.

## Features
- Visualization of large amount of measurements
- Clear coverage visualization
- Saving/loading of the inspection data
- Fast visualization and data access times due to usage of octrees
- Simple to integrate C++ library
- Python bindings

### Planned Features
- Showing original camera images by selecting viewpoint in relation to the 3D model
- Recording of the robot's pose during recording of a data point

## Requirements for Usage
- known pose of the sensor (e.g. by using a tracking system or forward kinematics of the robot)
- for coverage visualization, a reference mesh (e.g. from the CAD model) is helpfull

## Installation and Usage

We recommend using Vinspect together with the ROS2 interface that we provide (see https://github.com/DLR-MO/vinspect_ros2 for installation and usage instructions).

If you prefer to use it without the ROS2 interface, you can include it into your project like any other C++ library.
Additionally, there are Python bindings which allow you integration into Python code.
Beware that the octree library is included as a git submodule and you need to pull this accordingly.
You can intantiate an object of the `Inspection` class and specify what types of sensors you want to use in the constructor.
Afterward, you can add data, visualize it and access it (see following sections).

### Adding Data
As explained above, the inspection can hold sparse data (single sensor measurement) and dense data (e.g. RGB-D images).
Each type is handled seperately.
You can call the `addSparseMeasurement()` function to add a new single sensor measurement to the inspection.
Similarly, you can call the `integrateImage()` function to add a new camera image.

### Visualizing
You can visualize the current state of the inspection in two different ways.
You can get a 3D mesh reconstruction based on the integrated RGB-D images by calling the `extractDenseReconstruction()` function.
The sparse data is visualized by creating a mesh of points (actually octagons) that merge multiple sensor measurements that are closest together.
This mesh can be optained by calling the `createMesh()` method of the `SparseMesh` class.

### Getting Data
The `Inspection` class offers multiple methods to directly access the data.
These are based on the underlying octree datastructure and are, therefore, fast.
This includes getting the
- closest sensor measurement (`getClosestSparseMeasurement()`)
- measurements in a specific area (`getSparseMeasurementsInRadius()`)

### Saving and Loading Data
The `Inspection` class allows to continously save the inspection data to prevent any data loss.
This can be activated by providing a save path in the constructor.
The data can be loaded later by calling the `load()` function.
It is then also possible to continue the inspection and appending new data to the loaded file.

# Contributing
Contributions are welcome (issues as well as pull requests).
We plan on further developing and using this software in the future and are happy for any
contributions from the community.
We follow the [ROS2 code style](https://docs.ros.org/en/rolling/The-ROS2-Project/Contributing/Code-Style-Language-Versions.html).

# Thanks
Thanks to [@attcs] for implementing the [Octree library](https://github.com/attcs/Octree/) which creatly facilitated the creation of this software.

Thanks to [@marrts] whose [industrial_reconstruction ROS2 package](https://github.com/ros-industrial/industrial_reconstruction) inspired the TSDF based 3D reconstruction part of Vinspect.

Thanks to [@marip8] whose [REACH software](https://github.com/ros-industrial/reach) inspired the clear seperation between core and ROS2 code.
1 change: 1 addition & 0 deletions colcon.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"hooks": ["share/vinspect/hook/python_path.dsv"]}
1 change: 1 addition & 0 deletions include/vinspect/Octree
Submodule Octree added at 79c7a2
Loading

0 comments on commit 04b6b34

Please sign in to comment.