Skip to content

Commit 69e9bb5

Browse files
Saurav AgarwalSaurav Agarwal
authored andcommitted
Merge branch 'restructure'
Add license and documentation. Restructure and cleanup.
2 parents e03432e + 91e0b62 commit 69e9bb5

File tree

140 files changed

+44581
-5901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+44581
-5901
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
data/
22
osm_dataset_generator/cache/
33
osm_dataset_generator/leaflet_geojson_viz/data/
4+
doc/html/
5+
doc/latex/
46

57
# Prerequisites
68
*.d

cppsrc/core/CMakeLists.txt

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.22)
1+
cmake_minimum_required(VERSION 3.16)
22
project(CoverageControlCore VERSION 0.3 LANGUAGES CXX)
33

44
if (NOT CMAKE_BUILD_TYPE)
@@ -20,12 +20,10 @@ include(CheckCXXCompilerFlag)
2020
include(GNUInstallDirs)
2121

2222
find_package(OpenMP REQUIRED)
23-
find_package(Eigen3 REQUIRED)
24-
find_package(yaml-cpp REQUIRED)
25-
find_package(CGAL REQUIRED)
26-
find_package(GeographicLib REQUIRED)
23+
find_package(Eigen3 3.4 REQUIRED)
24+
find_package(CGAL 5.6 REQUIRED)
2725

28-
configure_file(cmake/CoverageControlCoreConfig.h.in CoverageControlCoreConfig.h)
26+
configure_file(cmake/${PROJECT_NAME}Config.h.in ${PROJECT_NAME}Config.h)
2927

3028
add_library(compiler_flags INTERFACE)
3129
target_compile_features(compiler_flags INTERFACE cxx_std_17)
@@ -37,69 +35,67 @@ target_compile_options(compiler_flags INTERFACE
3735
"$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>"
3836
)
3937

40-
4138
#################################
4239
## CoverageControlCore library ##
4340
#################################
4441

4542
set(sources_list
46-
generate_world_map.cu
4743
polygon_utils.cpp
4844
parameters.cpp
4945
voronoi.cpp
5046
coverage_system.cpp
5147
plotter.cpp
5248
extern/Hungarian.cpp)
53-
list(TRANSFORM sources_list PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/src/")
5449

55-
set(dependencies_list Eigen3::Eigen m stdc++fs OpenMP::OpenMP_CXX pthread boost_iostreams boost_system boost_filesystem ${GeographicLib_LIBRARIES} yaml-cpp)
56-
57-
add_library(CoverageControl_core SHARED ${sources_list})
50+
if (WITH_CUDA)
51+
list(APPEND sources_list
52+
generate_world_map.cu)
53+
endif()
54+
list(TRANSFORM sources_list PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/src/")
5855

59-
add_library(CoverageControlCore INTERFACE)
60-
target_include_directories(CoverageControlCore INTERFACE
61-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
62-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
63-
target_link_libraries(CoverageControlCore INTERFACE ${dependencies_list} CoverageControl_core)
56+
set(dependencies_list Eigen3::Eigen m stdc++fs OpenMP::OpenMP_CXX pthread boost_iostreams boost_system boost_filesystem)
6457

65-
target_include_directories(CoverageControl_core PRIVATE "${PROJECT_BINARY_DIR}")
66-
target_link_libraries(CoverageControl_core PRIVATE compiler_flags CGAL::CGAL)
67-
target_link_libraries(CoverageControl_core PUBLIC ${dependencies_list})
58+
add_library(${PROJECT_NAME} SHARED ${sources_list})
59+
target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_BINARY_DIR}")
60+
target_link_libraries(${PROJECT_NAME} PRIVATE compiler_flags CGAL::CGAL)
61+
target_link_libraries(${PROJECT_NAME} PUBLIC ${dependencies_list})
62+
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
6863

6964
if (WITH_CUDA)
70-
set_target_properties(CoverageControl_core PROPERTIES CUDA_ARCHITECTURES native POSITION_INDEPENDENT_CODE ON)
65+
set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_ARCHITECTURES native POSITION_INDEPENDENT_CODE ON)
7166
else()
72-
set_target_properties(CoverageControl_core PROPERTIES POSITION_INDEPENDENT_CODE ON)
67+
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
7368
endif()
7469

75-
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
76-
77-
install(TARGETS CoverageControl_core CoverageControlCore EXPORT CoverageControlCoreTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
70+
target_include_directories(${PROJECT_NAME} INTERFACE
71+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
72+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
7873

79-
install(FILES "${PROJECT_BINARY_DIR}/CoverageControlCoreConfig.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
74+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
75+
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
76+
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
8077

81-
set(CMAKEPACKAGE_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/CoverageControlCore)
78+
set(CMAKEPACKAGE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/cmake/${PROJECT_NAME}")
8279

8380
include(CMakePackageConfigHelpers)
8481
# generate the config file that includes the exports
85-
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
86-
${CMAKE_CURRENT_BINARY_DIR}/CoverageControlCoreConfig.cmake
87-
INSTALL_DESTINATION "${CMAKEPACKAGE_INSTALL_DIR}"
88-
NO_SET_AND_CHECK_MACRO
89-
NO_CHECK_REQUIRED_COMPONENTS_MACRO
90-
)
82+
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
83+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
84+
INSTALL_DESTINATION "${CMAKEPACKAGE_INSTALL_DIR}")
9185

9286
write_basic_package_version_file(
93-
"${CMAKE_CURRENT_BINARY_DIR}/CoverageControlCoreConfigVersion.cmake"
94-
VERSION "${CoverageControlCore_VERSION_MAJOR}.${CoverageControlCore_VERSION_MINOR}"
95-
COMPATIBILITY AnyNewerVersion
96-
)
87+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
88+
VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}"
89+
COMPATIBILITY AnyNewerVersion)
9790

98-
export (PACKAGE CoverageControlCore)
99-
install(EXPORT CoverageControlCoreTargets FILE CoverageControlCoreTargets.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CoverageControlCore)
91+
export (PACKAGE ${PROJECT_NAME})
10092

10193
install(FILES
102-
${CMAKE_CURRENT_BINARY_DIR}/CoverageControlCoreConfig.cmake
103-
${CMAKE_CURRENT_BINARY_DIR}/CoverageControlCoreConfigVersion.cmake
104-
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}
105-
)
94+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
95+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
96+
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR})
97+
98+
install(EXPORT ${PROJECT_NAME}Targets
99+
FILE ${PROJECT_NAME}Targets.cmake
100+
NAMESPACE CoverageControl::
101+
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR})

cppsrc/core/cmake/Config.cmake.in

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@PACKAGE_INIT@
2+
3+
set(PN CoverageControlCore)
4+
set(${PN}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
5+
set(${PN}_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
6+
set(${PN}_LIBRARY "${${PN}_LIBRARY_DIR}/lib${PN}.so")
7+
set(${PN}_DEFINITIONS USING_${PN})
8+
9+
if(NOT TARGET CoverageControl::${PN})
10+
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
11+
12+
find_package(OpenMP REQUIRED)
13+
find_package(Eigen3 3.4 REQUIRED)
14+
15+
set(dependencies_list Eigen3::Eigen m stdc++fs OpenMP::OpenMP_CXX pthread)
16+
target_link_libraries(CoverageControl::${PN} INTERFACE ${${PN}_LIBRARY} ${dependencies_list})
17+
18+
endif()
19+
check_required_components(${PN})

cppsrc/core/include/CoverageControl/algorithms/lloyd_local_sensor_global_comm.h renamed to cppsrc/core/include/CoverageControl/algorithms/centralized_cvt.h

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
/**
2-
* The coverage control algorithm uses Lloyd's algorithm on accumulated local map of individual robots, i.e., a robot has knowledge only about the regions it has visited.
3-
* Communication radius is not considered
4-
* The algorithm is online---it takes localized actions based on the current robot positions.
5-
**/
1+
/*
2+
* This file is part of the CoverageControl library
3+
*
4+
* Author: Saurav Agarwal
5+
6+
* Repository: https://github.com/KumarRobotics/CoverageControl
7+
*
8+
* The CoverageControl library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9+
*
10+
* The CoverageControl library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU General Public License along with CoverageControl library. If not, see <https://www.gnu.org/licenses/>.
13+
*/
614

7-
#ifndef COVERAGECONTROL_ALGORITHMS_LLOYD_LOCAL_SENSOR_GLOBAL_COMM_H_
8-
#define COVERAGECONTROL_ALGORITHMS_LLOYD_LOCAL_SENSOR_GLOBAL_COMM_H_
15+
/*!
16+
* \file centralized_cvt.h
17+
* \brief Contains the class CentralizedCVT
18+
*/
19+
20+
#ifndef COVERAGECONTROL_ALGORITHMS_CENTRALIZED_CVT_H_
21+
#define COVERAGECONTROL_ALGORITHMS_CENTRALIZED_CVT_H_
922

1023
#include <vector>
1124
#include <fstream>
@@ -22,7 +35,12 @@
2235

2336
namespace CoverageControl {
2437

25-
class LloydLocalSensorGlobalComm {
38+
/*!
39+
* The coverage control algorithm uses centralized Centroidal Voronoi Tessellation (CVT) or Lloyd's algorithm on accumulated local map of individual robots, i.e., a robot has knowledge only about the regions it has visited.
40+
* Communication radius is not considered.
41+
* The algorithm is online---it takes localized actions based on the current robot positions.
42+
**/
43+
class CentralizedCVT {
2644
private:
2745
Parameters const params_;
2846
size_t num_robots_ = 0;
@@ -35,7 +53,7 @@ namespace CoverageControl {
3553
bool continue_flag_ = false;
3654

3755
public:
38-
LloydLocalSensorGlobalComm(
56+
CentralizedCVT (
3957
Parameters const &params,
4058
size_t const &num_robots,
4159
CoverageSystem &env) :
@@ -98,4 +116,4 @@ namespace CoverageControl {
98116
};
99117

100118
} /* namespace CoverageControl */
101-
#endif /* COVERAGECONTROL_ALGORITHMS_LLOYD_LOCAL_SENSOR_GLOBAL_COMM_H_ */
119+
#endif /* COVERAGECONTROL_ALGORITHMS_CENTRALIZED_CVT_H_ */

cppsrc/core/include/CoverageControl/algorithms/lloyd_global_online.h renamed to cppsrc/core/include/CoverageControl/algorithms/clairvyont_cvt.h

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
/**
2-
* The coverage control algorithm uses Lloyd's algorithm on global world IDF map, i.e., it has knowledge of the entire map.
3-
* Communication is not considered in this algorithm, i.e., all robots are assumed to be able to communicate with each other.
4-
* However, the algorithm is online---it takes localized actions based on the current robot positions.
5-
**/
1+
/*
2+
* This file is part of the CoverageControl library
3+
*
4+
* Author: Saurav Agarwal
5+
6+
* Repository: https://github.com/KumarRobotics/CoverageControl
7+
*
8+
* The CoverageControl library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9+
*
10+
* The CoverageControl library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU General Public License along with CoverageControl library. If not, see <https://www.gnu.org/licenses/>.
13+
*/
614

7-
#ifndef COVERAGECONTROL_ALGORITHMS_LLOYD_GLOBAL_ONLINE_H_
8-
#define COVERAGECONTROL_ALGORITHMS_LLOYD_GLOBAL_ONLINE_H_
15+
/*!
16+
* \file clairvyont_cvt.h
17+
* \brief Clairvoyant CVT algorithm
18+
*/
19+
20+
#ifndef COVERAGECONTROL_ALGORITHMS_CLAIRVOYANT_CVT_H_
21+
#define COVERAGECONTROL_ALGORITHMS_CLAIRVOYANT_CVT_H_
922

1023
#include <vector>
1124
#include <fstream>
@@ -20,11 +33,16 @@
2033
#include "../typedefs.h"
2134
#include "../coverage_system.h"
2235
#include "../map_utils.h"
23-
#include "lloyd_algorithms.h"
2436

2537
namespace CoverageControl {
2638

27-
class LloydGlobalOnline {
39+
/*!
40+
* Clairvoyant CVT algorithm
41+
* The algorithm has knowledge of the entire map in a centralized manner.
42+
* It uses the CVT to compute centroids of the Voronoi cells and assigns the robots to the centroids.
43+
* The algorithm is online---it takes localized actions based on the current robot positions.
44+
*/
45+
class ClairvyontCVT {
2846
private:
2947
Parameters const params_;
3048
size_t num_robots_ = 0;
@@ -37,7 +55,7 @@ namespace CoverageControl {
3755
bool continue_flag_ = false;
3856

3957
public:
40-
LloydGlobalOnline(
58+
ClairvyontCVT (
4159
Parameters const &params,
4260
size_t const &num_robots,
4361
CoverageSystem &env) :
@@ -100,4 +118,4 @@ namespace CoverageControl {
100118
};
101119

102120
} /* namespace CoverageControl */
103-
#endif /* COVERAGECONTROL_ALGORITHMS_LLOYD_GLOBAL_ONLINE_H_ */
121+
#endif /* COVERAGECONTROL_ALGORITHMS_CLAIRVOYANT_CVT_H_ */

cppsrc/core/include/CoverageControl/algorithms/lloyd_local_voronoi.h renamed to cppsrc/core/include/CoverageControl/algorithms/decentralized_cvt.h

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
/**
2-
* The coverage control algorithm uses Lloyd's algorithm on accumulated local map of individual robots, i.e., a robot has knowledge only about the regions it has visited.
3-
* Communication limitations are considered in the computation of voronoi.
4-
* Each robot computes the voronoi based on its local map and the positions of other robots within its communication range.
5-
* The algorithm is online---it takes localized actions based on the current robot positions.
6-
**/
7-
8-
#ifndef COVERAGECONTROL_ALGORITHMS_LLOYD_LOCAL_VORONOI_H_
9-
#define COVERAGECONTROL_ALGORITHMS_LLOYD_LOCAL_VORONOI_H_
1+
/*
2+
* This file is part of the CoverageControl library
3+
*
4+
* Author: Saurav Agarwal
5+
6+
* Repository: https://github.com/KumarRobotics/CoverageControl
7+
*
8+
* The CoverageControl library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9+
*
10+
* The CoverageControl library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU General Public License along with CoverageControl library. If not, see <https://www.gnu.org/licenses/>.
13+
*/
14+
15+
/*!
16+
* \file decentralized_cvt.h
17+
* \brief Contains the DecentralizedCVT class.
18+
*/
19+
20+
21+
#ifndef COVERAGECONTROL_ALGORITHMS_DECENTRALIZED_CVT_H_
22+
#define COVERAGECONTROL_ALGORITHMS_DECENTRALIZED_CVT_H_
1023

1124
#include <vector>
1225
#include <fstream>
@@ -21,12 +34,16 @@
2134
#include "../typedefs.h"
2235
#include "../coverage_system.h"
2336
#include "../map_utils.h"
24-
#include "lloyd_algorithms.h"
2537
#include "../extern/lsap/Hungarian.h"
2638

2739
namespace CoverageControl {
2840

29-
class LloydLocalVoronoi {
41+
/*!
42+
* This class implements the decentralized CVT algorithm.
43+
* The algorithm uses the local map of each robot and the positions of other robots within its communication range to compute the voronoi.
44+
* The algorithm is online---it takes localized actions based on the current robot positions.
45+
*/
46+
class DecentralizedCVT {
3047
private:
3148
Parameters const params_;
3249
size_t num_robots_ = 0;
@@ -38,7 +55,7 @@ namespace CoverageControl {
3855
bool continue_flag_ = false;
3956

4057
public:
41-
LloydLocalVoronoi(
58+
DecentralizedCVT (
4259
Parameters const &params,
4360
size_t const &num_robots,
4461
CoverageSystem &env) :
@@ -138,4 +155,4 @@ namespace CoverageControl {
138155
};
139156

140157
} /* namespace CoverageControl */
141-
#endif /* COVERAGECONTROL_ALGORITHMS_LLOYD_LOCAL_VORONOI_H_ */
158+
#endif /* COVERAGECONTROL_ALGORITHMS_DECENTRALIZED_CVT_H_ */

0 commit comments

Comments
 (0)