Skip to content

Commit

Permalink
Merge pull request #32 from nilsbore/update_libigl2
Browse files Browse the repository at this point in the history
Update libigl to newer version and fix cmake install targets
  • Loading branch information
nilsbore authored Sep 4, 2019
2 parents 64d62a6 + 46af530 commit b6b9ad7
Show file tree
Hide file tree
Showing 22 changed files with 126 additions and 251 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "libigl"]
path = libigl
url = https://github.com/libigl/libigl-legacy.git
path = src/libigl
url = https://github.com/libigl/libigl.git
[submodule "src/pybind11"]
path = src/pybind11
url = https://github.com/pybind/pybind11.git
Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ compiler:
- clang
os:
- linux
git:
submodules: false
before_install:
- echo $LANG
- echo $LC_ALL
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
- sudo apt-get update
- apt list libceres-dev -a
- sudo apt-get install -y libcereal-dev libglfw3-dev libceres-dev libtinyxml2-dev
- sudo apt-get install -y --allow-unauthenticated libcereal-dev libglfw3-dev libceres-dev libtinyxml2-dev libopencv-dev libboost-all-dev
install:
- git submodule update --init
- cd libigl
- git submodule update --init external/embree
- git submodule update --init external/glfw
- cd ..
script:
- mkdir build && cd build
- cmake -DCMAKE_INSTALL_PREFIX=../install ../src
- make
branches:
only:
- update_libigl2
- master
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# auvlib

[![Build Status](https://travis-ci.org/nilsbore/auvlib.svg?branch=master)](https://travis-ci.org/nilsbore/auvlib)
[![license](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

Tools for reading AUV deployment data files and for
processing and visualization of side scan and multibeam data.
Extensive documentation for the python API is available
Expand All @@ -20,10 +23,6 @@ sudo apt-get install libcereal-dev libglfw3-dev libceres-dev libtinyxml2-dev
Once cloned, you need to get the libigl submodule and some of its dependencies:
```
git submodule update --init
cd libigl
git submodule update --init external/embree
git submodule update --init external/glfw
cd ..
```

When done, create a `build` folder in the repo root, and run
Expand Down
18 changes: 8 additions & 10 deletions example_projects/complete_project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

find_package(Ceres REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(PCL 1.7 REQUIRED)
find_package(OpenCV REQUIRED)

option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" OFF)
Expand All @@ -29,21 +28,20 @@ option(LIBIGL_WITH_TRIANGLE "Use Triangle" OFF)
option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" ON)
option(LIBIGL_WITH_XML "Use XML" OFF)

set(ENV{LIBIGL_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../src/libigl)
find_package(LIBIGL REQUIRED QUIET)
find_package(LibXTF REQUIRED)
find_package(LibGSF REQUIRED)
find_package(EigenCereal REQUIRED)
find_package(SparseGP REQUIRED)
find_package(DataTools REQUIRED)
find_package(GPGSSlam REQUIRED)
find_package(AuvlibGlad REQUIRED)
find_package(SonarTracing REQUIRED)
find_package(BathyMaps REQUIRED)

link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
include_directories(include ${CERES_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS})

add_executable(example_slam src/example_slam.cpp)
target_link_libraries(example_slam submaps gp_submaps gpgs_cost_function gpgs_visualization gpgs_multi_visualizer gpgs_igl_visualizer data_structures)
#link_directories(${PCL_LIBRARY_DIRS})
#add_definitions(${PCL_DEFINITIONS})
include_directories(include ${CERES_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS})

add_executable(example_mesh src/example_mesh.cpp)
target_link_libraries(example_mesh data_structures gsf_data xtf_data csv_data navi_data mesh_map draw_map ${OpenCV_LIBS})
#target_link_libraries(example_mesh data_structures gsf_data xtf_data csv_data navi_data mesh_map draw_map ${OpenCV_LIBS})
target_link_libraries(example_mesh std_data gsf_data xtf_data csv_data navi_data mesh_map draw_map patch_draper igl::core igl::opengl_glfw igl::embree ${OpenCV_LIBS})
2 changes: 1 addition & 1 deletion example_projects/complete_project/cmake/FindLIBIGL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ find_package_handle_standard_args(LIBIGL
LIBIGL_INCLUDE_DIR)
mark_as_advanced(LIBIGL_INCLUDE_DIR)

list(APPEND CMAKE_MODULE_PATH "${LIBIGL_INCLUDE_DIR}/../shared/cmake")
list(APPEND CMAKE_MODULE_PATH "${LIBIGL_INCLUDE_DIR}/../cmake")
include(libigl)
51 changes: 42 additions & 9 deletions example_projects/complete_project/src/example_mesh.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/* Copyright 2018 Nils Bore ([email protected])
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <cereal/archives/json.hpp>

#include <cxxopts.hpp>
Expand All @@ -9,15 +20,16 @@

#include <bathy_maps/draw_map.h>
#include <bathy_maps/mesh_map.h>

#include <sparse_gp/sparse_gp.h>
#include <sparse_gp/rbf_kernel.h>
#include <sparse_gp/gaussian_noise.h>
#include <bathy_maps/patch_draper.h>

#include <opencv2/highgui/highgui.hpp>
#include <chrono>

using namespace std;
using namespace std_data;
using namespace csv_data;
using namespace gsf_data;
using namespace xtf_data;

// we should probably put this in data_tools eventually, it's very convenient
template <typename T>
Expand Down Expand Up @@ -78,18 +90,21 @@ int main(int argc, char** argv)
{
string mbes_folder_str;
string sss_folder_str;
string entries_file_str;
string file_str;
double lsq = 7; //10.;
double sigma = 1.; //5.;
double s0 = 0.03; //.2;
double pose_sigma = 0.2; //0.4;
double sensor_yaw = 5.*M_PI/180.;
string dataset_name = "ping_mesh";

cxxopts::Options options("MyProgram", "One line description of MyProgram");
options.add_options()
("help", "Print help")
("swaths", "Input gsf mb swaths folder pre deployment", cxxopts::value(mbes_folder_str))
("sss", "Input gsf mb swaths folder pre deployment", cxxopts::value(sss_folder_str))
("nav", "Nav entries file", cxxopts::value(entries_file_str))
("file", "Output file", cxxopts::value(file_str))
("lsq", "RBF length scale", cxxopts::value(lsq))
("sigma", "RBF scale", cxxopts::value(sigma))
Expand All @@ -113,32 +128,50 @@ int main(int argc, char** argv)

boost::filesystem::path mbes_folder(mbes_folder_str);
boost::filesystem::path sss_folder(sss_folder_str);
boost::filesystem::path entries_file(entries_file_str);
boost::filesystem::path path(file_str);

cout << "Input mbes folder : " << mbes_folder << endl;
cout << "Input sss folder : " << sss_folder << endl;
cout << "Output file : " << path << endl;

bathy_map_mesh mesh;
csv_nav_entry::EntriesT entries = load_or_parse_entries(entries_file);
for (int counter = 0; counter < entries.size(); counter += 10000) {
cout << "Time stamp: " << entries[counter].time_string_ << endl;
}

Eigen::MatrixXd V;
Eigen::MatrixXi F;
bathy_map_mesh::BoundsT bounds;
mesh_map::BoundsT bounds;

// we need to separate the reading of mbes and side scan pings since they consume a lot of memory
{
gsf_mbes_ping::PingsT pings_mbes = load_or_parse_pings<gsf_mbes_ping>(mbes_folder, dataset_name + "_mbes");
mbes_ping::PingsT pings = convert_pings(pings_mbes);

tie(V, F, bounds) = mesh.mesh_from_pings(pings);
tie(V, F, bounds) = mesh_map::mesh_from_pings(pings);
}
//mesh.display_mesh(V, F);
mesh_map::show_mesh(V, F);
cout << "SSS" << endl;

{
xtf_sss_ping::PingsT pings_sss = load_or_parse_pings<xtf_sss_ping>(sss_folder, dataset_name + "_sss");
for (int counter = 0; counter < pings_sss.size(); counter += 100) {
cout << "Time stamp: " << pings_sss[counter].time_string_ << endl;
}
pings_sss = convert_matched_entries(pings_sss, entries);
pings_sss = correct_sensor_offset(pings_sss, Eigen::Vector3d(2., -1.5, 0.));
cout << "Number of entries in file " << entries_file << ": " << entries.size() << endl;
/*for (xtf_sss_ping& ping : pings_sss) {
ping.pitch_ = 0.2;
//cereal::JSONOutputArchive ar(std::cout);
//ar(ping);
}*/
cv::Mat waterfall_img = make_waterfall_image(pings_sss);
cv::imshow("My image", waterfall_img);
cv::waitKey();
mesh.overlay_sss(V, F, bounds, pings_sss);
csv_asvp_sound_speed::EntriesT sound_speeds;
drape_patches(V, F, bounds, pings_sss, sound_speeds, sensor_yaw);
}

return 0;
Expand Down
Loading

0 comments on commit b6b9ad7

Please sign in to comment.