Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/modules/trajectory_generation/domain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@ find_package(Eigen3 REQUIRED)
set(SPLINE_GENERATION spline_generation)
set(TRAJECTORY_GENERATION trajectory_generation)
set(GRAPH_GENERATION graph_generation)
set(COST_CALCULATION cost_calculation)

# Store all .cpp and .hpp files in a variable
file(GLOB spline_cpp_files "${SPLINE_GENERATION}/*.cpp")
file(GLOB trajectory_cpp_files "${TRAJECTORY_GENERATION}/*.cpp")
file(GLOB graph_cpp_files "${GRAPH_GENERATION}/*.cpp")
file(GLOB cost_cpp_files "${COST_CALCULATION}/*.cpp")


file(GLOB spline_hpp_files "${SPLINE_GENERATION}/*.hpp")
file(GLOB trajectory_hpp_files "${TRAJECTORY_GENERATION}/*.hpp")
file(GLOB graph_hpp_files "${GRAPH_GENERATION}/*.hpp")
file(GLOB cost_hpp_files "${COST_CALCULATION}/*.hpp")

# Add library
add_library(${SPLINE_GENERATION} ${spline_cpp_files})
add_library(${TRAJECTORY_GENERATION} ${trajectory_cpp_files})
add_library(${GRAPH_GENERATION} ${graph_cpp_files})
add_library(${COST_CALCULATION} ${cost_cpp_files})

# Link Dependencies
target_link_libraries(${TRAJECTORY_GENERATION} ${SPLINE_GENERATION})
Expand All @@ -33,6 +38,7 @@ target_link_libraries(${GRAPH_GENERATION} ${TRAJECTORY_GENERATION})
ament_target_dependencies(${SPLINE_GENERATION} common_domain)
ament_target_dependencies(${TRAJECTORY_GENERATION} common_domain)
ament_target_dependencies(${GRAPH_GENERATION} common_domain)
ament_target_dependencies(${COST_CALCULATION} common_domain)

# Export target and also its dependencies so that you don't have to call
# find_package() for each of the dependencies
Expand All @@ -42,6 +48,8 @@ ament_export_targets(${TRAJECTORY_GENERATION}Targets HAS_LIBRARY_TARGET)
ament_export_dependencies(common_domain)
ament_export_targets(${GRAPH_GENERATION}Targets HAS_LIBRARY_TARGET)
ament_export_dependencies(common_domain)
ament_export_targets(${COST_CALCULATION}Targets HAS_LIBRARY_TARGET)
ament_export_dependencies(common_domain)

# Specify the include directories to enable cmake to build and install
target_include_directories(${SPLINE_GENERATION} PUBLIC
Expand All @@ -56,6 +64,10 @@ target_include_directories(${GRAPH_GENERATION} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${GRAPH_GENERATION}>
$<INSTALL_INTERFACE:include/${GRAPH_GENERATION}> # <prefix>/include/mylib
)
target_include_directories(${COST_CALCULATION} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${COST_CALCULATION}>
$<INSTALL_INTERFACE:include/${COST_CALCULATION}> # <prefix>/include/mylib
)

# Install all header files to the desired location
install(
Expand All @@ -70,6 +82,10 @@ install(
FILES ${graph_hpp_files}
DESTINATION include/${GRAPH_GENERATION}
)
install(
FILES ${cost_hpp_files}
DESTINATION include/${COST_CALCULATION}
)

# Install the library
install(TARGETS ${SPLINE_GENERATION}
Expand All @@ -87,5 +103,10 @@ install(TARGETS ${GRAPH_GENERATION}
LIBRARY DESTINATION lib/
INCLUDES DESTINATION include/
)
install(TARGETS ${COST_CALCULATION}
EXPORT ${COST_CALCULATION}Targets
LIBRARY DESTINATION lib/
INCLUDES DESTINATION include/
)

ament_package()
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef TRAJECTORY_GENERATION__COST_CALCULATION__I_COST_CALCULATOR_HPP
#define TRAJECTORY_GENERATION__COST_CALCULATION__I_COST_CALCULATOR_HPP


namespace trajectory_generation::cost_calculation {

class ICostCalculator {
public:
/**
* @brief Get the overall cost for an object
*
* @return double
*/
virtual double get_cost() const = 0;
};
}

#endif /*TRAJECTORY_GENERATION__COST_CALCULATION__I_COST_CALCULATOR_HPP*/