Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
9and3 committed May 27, 2024
2 parents 61de9ea + 604b5ba commit 39e118b
Show file tree
Hide file tree
Showing 24 changed files with 692 additions and 222 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ scanned_map
*.so
*.dylib
*.dll
# make an exception for GH_IO.dll
!GH_IO.dll

# Fortran module files
*.mod
Expand Down Expand Up @@ -263,4 +265,9 @@ scanned_map/*

# do not track the files contained in "temp" folder
temp/*
!temp/.gitkeep
!temp/.gitkeep

# the following files are inside for convinience and for cross-machine compatibility of paths in config.ini
AC_acims/*
AC_scanned_map/*
AC_videorec/*
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
branch = main
path = deps/TTool
url = [email protected]:ibois-epfl/TTool.git
[submodule "deps/eventpp"]
branch = main
path = deps/eventpp
url = [email protected]:ibois-epfl/eventpp.git
25 changes: 1 addition & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ set(BUILD_SHARED_LIBS ON)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(external_tools)
#set(CMAKE_CXX_STANDARD 17)
#TODO: check for Opencv 4.5.4 that cannot be installed or detected

file(GLOB_RECURSE AIAC_SRC "src/*.cpp")

Expand All @@ -30,18 +28,8 @@ target_precompile_headers(${PROJECT_NAME} PRIVATE src/aiacpch.h)
#-------------------------------------------------------------------------------
# Add options
#-------------------------------------------------------------------------------

# *As a fresh new compile, put everything ON
# -------------------- COMPILE OPTIONS -----------------------------
# option(INSTALL_TSLAM "Install TSlam in case it has been updated" OFF)
# option(INSTALL_TTOOL "Install TTool in case it has been updated" OFF)
# ------------------------------------------------------------------------------
# option(INSTALL_GLFW33 "Install glfw3 with dpkg" OFF)
# option(INSTALL_OPENGL "Install OpenGL with dpkg" OFF)
# option(INSTALL_OPENCV455 "Install Opencv4.5.4" OFF)
# option(INSTALL_ASSIMP "Install assimp with dpkg" OFF)
# -------------------- PREPROCESSOR VAR OPTIONS --------------------
option(DEPLOY_ON_TOUCH "Build AC for testing on an external touch monitor" OFF)
option(DEPLOY_ON_TOUCH "Build AC for testing on an external touch monitor" ON)
option(ENABLE_ASSERT "Enable assertion in code" ON)
option(SILENT_LOGGING "Do not log messages in the terminal if on." ON)
# -------------------- TEST OPTIONS --------------------------------
Expand Down Expand Up @@ -71,20 +59,9 @@ endif()
# GLOBAL 3rd libs (NOT compatible with add_subdirectory())
#------------------------------------------------------------------------------------------------------------
# OpenGL
# if(UNIX AND INSTALL_OPENGL)
# message(WARNING "OpenGL not found, trying to install it...")
# execute_process(COMMAND ./cmake/install_opengl.sh)
# endif()
set(OpenGL_GL_PREFERENCE LEGACY) # <-- temp fix: or GLVIND?
find_package(OpenGL REQUIRED)

# execute_process(COMMAND glxinfo -B OUTPUT_VARIABLE GLXINFO
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# string(REGEX MATCH "OpenGL version string: ([0-9.]+)" GLXINFO ${GLXINFO})
# message(STATUS "OpenGL version: ${CMAKE_MATCH_1}")
#message(STATUS "OpenGL icnlude dir: ${OPENGL_INCLUDE_DIR}")
#message(STATUS "OpenGL libraries: ${OPENGL_LIBRARIES}")

set(BUILD_V4_API ON)
add_external_package(TSlam)
add_external_package(TTool IGNORE_SYSTEM)
Expand Down
173 changes: 42 additions & 131 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,126 +8,16 @@
<img src="https://badges.frapsoft.com/os/v2/open-source.svg?v=103" href="https://github.com/ellerbrock/open-source-badges/">
</p>

TEST

# Augmented Carpentry

## Roof prototype
The first structure is a a typical roof parametrized and modified to complexify the fabrication. The optimization of the structure was meant to obtain a structure where each element is unique either by length, angle or shape. The goal was to demonstrate the utility of the technology in a manufacturing a complex structure without the need of 2D drawings or marking on the timber pieces.

test CI

<p align="center">
<img src="mockups/proto_x.png" width="500">
<img src="mockups/gh_snap.png">
</p>

```
Timber bill for AC prototype
Catalog: https://www.getaz-miauton.ch/fileadmin/CrhOneInternet/user_upload/2022-03-02_Massivholz_SR-FR_2022.pdf
section: 0.2,0.14 m / serial number: 61201420 / Total linear length: 123.83 m
section: 0.14,0.08 m / serial number: 7925785 / Total linear length: 64.86 m
section: 0.14,0.14 m / serial number: 61201414 / Total linear length: 24.26 m
section: 0.08,0.06 m / serial number: 61130607 / Total linear length: 94.89 m
```



---


## TODOList
> - [ ] the change of the calibration file brakes the tslam (but not the ttool it seems)
> - [ ] when we create the output yaml map we should not the calibration file and/or the camera model since this files is calibration-dependent
> - [ ] create find package for TSlam instead install it locally
> - [ ] for the reporitories we roked in IBOIS for the gitsubmodules, be sure that nobody can do modifications
> - [ ] Design AC custom 3D file for import of execution 3D models (only points and lines)
> - [x] Add Mapping subprogram + UI
> - [x] Implement padding for 3D scene viewer
> - [x] Test if changing map on the go breaks the slam or not
> - [ ] (*important*) vanilla tslam runs way smoother. We might have bottleneck in the AC software since we bleed frames. We should set a profiler and see where we can optimize.
> - [ ] create find package for TSlam instead install it locally
> - [ ] for the reporitories we roked in IBOIS for the gitsubmodules, be sure that nobody can do modifications
> - [ ] Design AC custom 3D file for import of execution 3D models (only points and lines)
[//]: # (> - [x] Add Mapping subprogram + UI)
[//]: # (> - [x] Implement padding for 3D scene viewer)
[//]: # (> - [x] Test if changing map on the go breaks the slam or not)

[//]: # (> - [x] Write a sub-program to calibrate the camera and export the correct format in xml)

> - [ ] Find a way to sync SLAM maps and data
[//]: # (> - [x] Make the Camera of the viewport bigger)

[//]: # (> - [x] Add pop up program to calibrate camera)

> - [ ] Double check if `Dloader.h` is working somewhere or need refactoring/suppression
> - [ ] Double check if `Dloader.h` is working somewhere or need refactoring/suppression
> - [ ] Add `this->properties` as rule in contributing guide and refactor all the code
[//]: # (> - [x] Make the Camera of the viewport bigger &#40;Defined in `Renderer.cpp:139`&#41;)

[//]: # (> - [x] Edit the readme for render API how to use it)
[//]: # (> - [x] Refactor the Render part, put everything in one folder and extract/rename render API header.)
[//]: # (> - [x] Add a function DrawCircle&#40;&#41; to the RenderAPI)
[//]: # (> - [x] Add a function DrawCylinder&#40;&#41; to the RenderAPI)
[//]: # (> - [x] Add a function DrawPolyline&#40;&#41; to the RenderAPI)
[//]: # (> - [x] Add a function DrawTriangle&#40;&#41; to the RenderAPI)
[//]: # (> - [x] Add a function DrawText&#40;&#41; to the RenderAPI)
[//]: # (> - [x] Fix the textRender, which is either not shown or overriding the scene)
> - [ ] Cache objects in RenderAPI for speed up (option)
[//]: # (> - [x] We have to check &#40;or at least catch&#41; the error that may occur due to the incompatible camera parameter and SLAM map after camera calibration.)
[//]: # (> - [x] Undistort Camera view)
> - [ ] Bug when selecting path & filename to "save" (can't type)
> - [ ] Make the viewport size a config (now is fixed in the code)
> - [ ] Load Mesh from UI
> - [ ] VideoRecorder: Implement handling for starting a new video while the previous one is still in the processing phase.
> - [ ] VideoRecorder: Button color for pressed and unpressed states.
> - [ ] VideoRecorder: Reduce video file size.
## Set touch monitor

The prototype is tested on a touch screen 7inch HDMI LCD (B) (WaveShare WS170120) and a laptop running Ubuntu 20/22.04 LTS. To config the touch screen on the pc follow [these steps first](https://www.waveshare.com/wiki/7inch_HDMI_LCD). Be sure to switch the display on, plug the mini-USB and finally plug the HDMI cable.

Set the display properties in the `config.ini` properties (to find them run the commands `xinput` for the name and `xrandr` for the connection type).

The following specs works on the X11 display server. If you are using wayland and wanting to switch to X11 follow [this link](https://helpdesk.psionline.com/hc/en-gb/articles/13470827149332-How-to-perform-the-switch-from-the-Wayland-display-server-to-Xorg-X11-on-Linux-Ubuntu-22-04-LTS)
./
```c++
[MonitorSpecs]
monitor_name = WaveShare WS170120
monitor_link_t = HDMI
monitor_resolution = 800x480
```
For wayland display server. WARNING: Wayland display and touchscreen are not compatible yet as the touchscreen register for the main display and not the small display.
```c++
[MonitorSpecs]
LinkMode = XWAYLAND1
Name = Virtual core pointer
Resolution = 800x480
or
```bash
git clone https://github.com/ibois-epfl/augmented-carpentry.git
git submodule sync
git pull --recurse-submodules
```
**You can build AS with the touch screen or on a non-touch screen.** To do so set ON or OFF the CMake option `DEPLOY_ON_TOUCH` in the `CMakeLists.txt`:

<br />

## STag PDFs
Stags are prepared in PDFs batches of ~150 stripes. You can find them [here](https://drive.google.com/drive/folders/1jic85gclymiV9014zc3tuUgIBq8lTyZr?usp=sharing).
They are made to be print as stickers. The code to generate them can be found ![here](https://github.com/ibois-epfl/TSlam/tree/main/stag_util).


<br />


## System dependecies
AC needs some local libraries already installed before compilation with cmake.
Expand All @@ -138,7 +28,8 @@ Next we need glm dependencies and libraries:
```bash
sudo apt-get -y install libmpfr-dev libboost-dev libgoogle-glog-dev \
freeglut3-dev libglew-dev libglfw3 libglfw3-dev \
git-lfs libassimp-dev libglm-dev libimgui-dev
git-lfs libassimp-dev libglm-dev libimgui-dev \
libcgal-dev
```

For tbb and opencv you will also need these:
Expand All @@ -155,25 +46,14 @@ For the video recorder you will need opencv too and ffmpeg
sudo apt -y install ffmpeg
```

```bash
## Build & run
Cloning the repo with submodules
```bash
git clone --recursive [email protected]:ibois-epfl/augmented-carpentry.git
```
or
```bash
git clone [email protected]:ibois-epfl/augmented-carpentry.git
git submodule sync
git pull --recurse-submodules
```

Next you need to pull the PyTorch dependency with the Large File System in git, to do this:
```bash
cd deps/TTool
git lfs pull
```

## Build

Time to build.. If you are deploying on a touch monitor set the flag `-DDEPLOY_ON_TOUCH=ON`, you can config:

```bash
Expand All @@ -187,5 +67,36 @@ To run the code:
./build/bin/AC
```

## How to contribute
Please have a look at the `contributing.md" file. There you will find all the set of rules and the main softwarer documentation to contribute.
## Set touch monitor

The prototype is tested on a touch screen 7inch HDMI LCD (B) (WaveShare WS170120) and a laptop running Ubuntu 20/22.04 LTS. To config the touch screen on the pc follow [these steps first](https://www.waveshare.com/wiki/7inch_HDMI_LCD). Be sure to switch the display on, plug the mini-USB and finally plug the HDMI cable.

Set the display properties in the `config.ini` properties (to find them run the commands `xinput` for the name and `xrandr` for the connection type).

The following specs works on the X11 display server. If you are using wayland and wanting to switch to X11 follow [this link](https://helpdesk.psionline.com/hc/en-gb/articles/13470827149332-How-to-perform-the-switch-from-the-Wayland-display-server-to-Xorg-X11-on-Linux-Ubuntu-22-04-LTS)
./

```c++
[MonitorSpecs]
monitor_name = WaveShare WS170120
monitor_link_t = HDMI
monitor_resolution = 800x480
```

For wayland display server. WARNING: Wayland display and touchscreen are not compatible yet as the touchscreen register for the main display and not the small display.

```c++
[MonitorSpecs]
LinkMode = XWAYLAND1
Name = Virtual core pointer
Resolution = 800x480
```

> You can build AC with the touch screen or on a non-touch screen. To do so set ON or OFF the CMake option `DEPLOY_ON_TOUCH` in the `CMakeLists.txt`:
<br />

## STag PDFs
Stags are prepared in PDFs batches of ~150 stripes. You can find them [here](https://drive.google.com/drive/folders/1jic85gclymiV9014zc3tuUgIBq8lTyZr?usp=sharing).
They are made to be print as stickers. The code to generate them can be found ![here](https://github.com/ibois-epfl/TSlam/tree/main/stag_util).

8 changes: 4 additions & 4 deletions config.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[AIAC]
ACInfoModel = /home/localuser/AC_acims/mybeam.acim
ACInfoModel = AC_acims/mybeam.acim
AlignFlip = 0
AlignOffset = 0
AlignRotation = 8
CamID = 0
CamParamsFile = assets/tslam/calibration_orange_A_1280_720_r.yml
CamParamsFile = assets/tslam/calibration_orange_B_1280_720_r.yml
ScaleFactor = 50
ScannedModel = /home/localuser/AC_scanned_map/test_beam/map-2024-5-6-11-13-44.ply
ScannedModel = AC_scanned_map/test_beam/map-2024-5-6-11-13-44.ply

[Renderer]
DigitalModelPath = assets/tslam/example3dModel.ply
MeshPaths =
PointCloudMapPath = assets/tslam/examplePointCloud.ply

[TSlam]
MapFile = /home/localuser/AC_scanned_map/test_beam/map-2024-5-6-11-13-44.map
MapFile = AC_scanned_map/test_beam/map-2024-5-6-11-13-44.map
VocFile = assets/tslam/orb.fbow

[TTool]
Expand Down
2 changes: 1 addition & 1 deletion deps/TSlam
Submodule TSlam updated 171 files
1 change: 1 addition & 0 deletions deps/pugixml
Submodule pugixml added at 7c66cf
1 change: 1 addition & 0 deletions deps/spdlog
Submodule spdlog added at b75edf
2 changes: 1 addition & 1 deletion src/ACApp.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "aiacpch.h"
#include "AIAC.h"
#include "AIAC/LayerCameraCalib.h"

int main(int argc, char* argv[]) {
#ifdef __linux__
Expand Down Expand Up @@ -30,6 +29,7 @@ int main(int argc, char* argv[]) {
acApp_ptr->PushLayer<AIAC::LayerFeedback>();
acApp_ptr->PushLayer<AIAC::LayerUI>();
acApp_ptr->PushLayer<AIAC::LayerUtils>();
acApp_ptr->PushLayer<AIAC::LayerLogRecorder>();

acApp_ptr->GetRenderer()->Init();

Expand Down
3 changes: 2 additions & 1 deletion src/AIAC.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@

#include "AIAC/Layer.h"
#include "AIAC/LayerCamera.h"
#include "AIAC/LayerCameraCalib.h"
#include "AIAC/LayerSlam.h"
#include "AIAC/LayerUI.h"
#include "AIAC/LayerCamera.h"
#include "AIAC/LayerModel.h"
#include "AIAC/LayerToolhead.h"
#include "AIAC/LayerFeedback.h"
#include "AIAC/LayerUtils.h"
#include "AIAC/LayerLogRecorder.h"

#include "AIAC/Render/Renderer.h"
#include "AIAC/GOSys/GO.h"
Expand Down
4 changes: 1 addition & 3 deletions src/AIAC/ACInfoModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,6 @@ namespace AIAC
}

void ACInfoModel::Transform(glm::mat4x4 transformMat) {
auto rotationMat = glm::mat3x3(transformMat);

// bounding box
auto bbox = m_TimberInfo.m_Bbox;
for(int i = 0 ; i < bbox.size() ; i++){
Expand Down Expand Up @@ -607,7 +605,7 @@ namespace AIAC
return ACIMState::CURRENT;
}
else {
AIAC_ERROR("Invalid state string: {0}", state);
AIAC_ERROR("Invalid state string: \"{0}\"", state);
return ACIMState::NOT_DONE;
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/AIAC/ACInfoModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class TimberInfo{

inline std::string GetID() const { return m_ID; }
std::vector<std::string> GetAllComponentsIDs() const;
inline Component* GetComponent(std::string id) { return m_Components[id]; }
inline Component* GetComponent(const std::string& id) { return m_Components[id]; }
inline Component* GetCurrentComponent() {
if(m_Components.find(m_CurrentComponentID) == m_Components.end())
return nullptr;
Expand Down Expand Up @@ -284,6 +284,11 @@ class ACInfoModel
* @brief Save the current state to the loaded .acim file.
*/
void Save();

/**
* @brief Get the filepath to the loaded ACInfoModel.
*/
inline const std::string& GetFilePath() const { return m_FilePath; }

/**
* @brief Get the pugi::xml_document object
Expand Down
Loading

0 comments on commit 39e118b

Please sign in to comment.