add rcl lifecycle
* (refactor) add rcl_lifecycle package * (refactor) cleanup free calls * (fix) initialize state machine with external node handle * (dev) use external typesupport * (fix) use external typesupport * (fix) cleanup states * (fix) no pointer comparison in state machine * (test) refactor for rcl testing purpose * (test) test suite for lifecycle sequence * (dev) change to rcl_ret_t * (test) wrong transition test * (fix) dependency for isolated build * (clean) remove std_msgs as a dep * (fix) enable correct visibility control * (fix) correct test for initialization * (fix) correct visibility attributes * (dev) change default value to lifecycle_msgs * (clean) style and lifecycle prefix * (dev) cmake macro get_rcl_lifecycle_information * (cleanup) remove unused files' * (cleanup) remove callback pointer * (debug) add print state machine function * (review) address review comments * (bugfix) correct export in information.cmake * (fix) correct visibility control * (vcs) fix convertion from size_t to unsigned int * (typo) fix internal struct name * const correctness * get_available_states service * new service msgs * tes for multiple instances * (dev) return codes * initial refactor * test default sequence * refactor state machine * apply upstream changes * c++14 * disable state machine print * address review comments * uncrustify * fix comparison with unsigned warning
This commit is contained in:
parent
4590fc5f77
commit
a18ef97e5a
17 changed files with 2357 additions and 0 deletions
94
rcl_lifecycle/CMakeLists.txt
Normal file
94
rcl_lifecycle/CMakeLists.txt
Normal file
|
@ -0,0 +1,94 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(rcl_lifecycle)
|
||||
|
||||
find_package(ament_cmake REQUIRED)
|
||||
find_package(rcl REQUIRED)
|
||||
find_package(rmw REQUIRED)
|
||||
find_package(rmw_implementation_cmake REQUIRED)
|
||||
find_package(lifecycle_msgs REQUIRED)
|
||||
|
||||
include_directories(include)
|
||||
|
||||
set(rcl_lifecycle_sources
|
||||
src/com_interface.c
|
||||
src/default_state_machine.c
|
||||
src/rcl_lifecycle.c
|
||||
src/transition_map.c)
|
||||
set_source_files_properties(
|
||||
${rcl_lifecycle_sources}
|
||||
PROPERTIES language "C")
|
||||
|
||||
macro(targets)
|
||||
get_rcl_information("${rmw_implementation}" "rcl${target_suffix}")
|
||||
|
||||
### C-Library depending only on RCL
|
||||
add_library(
|
||||
rcl_lifecycle${target_suffix}
|
||||
SHARED
|
||||
${rcl_lifecycle_sources})
|
||||
|
||||
ament_target_dependencies(rcl_lifecycle${target_suffix}
|
||||
"rcl${target_suffix}"
|
||||
"lifecycle_msgs")
|
||||
|
||||
# Causes the visibility macros to use dllexport rather than dllimport,
|
||||
# which is appropriate when building the dll but not consuming it.
|
||||
target_compile_definitions(rcl_lifecycle${target_suffix} PRIVATE "RCL_LIFECYCLE_BUILDING_DLL")
|
||||
|
||||
install(TARGETS rcl_lifecycle${target_suffix}
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin)
|
||||
endmacro()
|
||||
|
||||
call_for_each_rmw_implementation(targets GENERATE_DEFAULT)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++14")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
find_package(ament_cmake_gtest REQUIRED)
|
||||
find_package(ament_lint_auto REQUIRED)
|
||||
find_package(rcl REQUIRED)
|
||||
ament_lint_auto_find_test_dependencies()
|
||||
|
||||
# Gtests
|
||||
ament_add_gtest(test_default_state_machine
|
||||
test/test_default_state_machine.cpp
|
||||
)
|
||||
if(TARGET test_default_state_machine)
|
||||
target_include_directories(test_default_state_machine PUBLIC
|
||||
${rcl_INCLUDE_DIRS}
|
||||
${rcl_lifecycle_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(test_default_state_machine ${PROJECT_NAME})
|
||||
endif()
|
||||
ament_add_gtest(test_multiple_instances
|
||||
test/test_multiple_instances.cpp
|
||||
)
|
||||
if(TARGET test_multiple_instances)
|
||||
target_include_directories(test_multiple_instances PUBLIC
|
||||
${rcl_INCLUDE_DIRS}
|
||||
${rcl_lifecycle_INCLUDE_DIRS}
|
||||
)
|
||||
target_link_libraries(test_multiple_instances ${PROJECT_NAME})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ament_export_dependencies(ament_cmake)
|
||||
ament_export_dependencies(lifecycle_msgs)
|
||||
ament_export_include_directories(include)
|
||||
ament_export_libraries(${PROJECT_NAME})
|
||||
ament_package(
|
||||
CONFIG_EXTRAS rcl_lifecycle-extras.cmake)
|
||||
|
||||
install(
|
||||
DIRECTORY cmake
|
||||
DESTINATION share/${PROJECT_NAME})
|
||||
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION include)
|
Loading…
Add table
Add a link
Reference in a new issue